'localhost', 'port' => 587, 'fromAddress' => 'test@test', 'fromName' => 'name', 'auth' => false, ]; $this->assertEquals($array, SmtpParams::fromArray($array)->toArray()); } public function testFromArray2(): void { $array = [ 'server' => 'localhost', 'port' => 587, 'fromAddress' => 'test@test', 'fromName' => 'name', 'auth' => true, 'connectionOptions' => ['test' => 'test'], 'authMechanism' => 'login', 'authClassName' => 'Test', 'username' => 'tester', 'password' => 'password', 'security' => 'ssl', ]; $this->assertEquals($array, SmtpParams::fromArray($array)->toArray()); } public function testBuilding(): void { $params = SmtpParams::create('localhost', 587) ->withFromAddress('test@test') ->withFromName('name') ->withAuth() ->withUsername('tester') ->withPassword('test') ->withAuthMechanism('login') ->withAuthClassName('Test') ->withConnectionOptions(['test' => 'test']); $this->assertEquals('localhost', $params->getServer()); $this->assertEquals(587, $params->getPort()); $this->assertEquals('test@test', $params->getFromAddress()); $this->assertEquals('name', $params->getFromName()); $this->assertEquals(true, $params->useAuth()); $this->assertEquals('tester', $params->getUsername()); $this->assertEquals('test', $params->getPassword()); $this->assertEquals(['test' => 'test'], $params->getConnectionOptions()); $this->assertEquals('Test', $params->getAuthClassName()); } }