/** * @covers \ZfExtra\Mail\Message::__call * @covers \ZfExtra\Mail\Message::setAddresses * @covers \ZfExtra\Mail\Message::addAddresses * @covers \ZfExtra\Mail\Message::getAddresses */ public function testAddTo() { $message = new Message(); $message->setTo('*****@*****.**'); $this->assertInstanceOf(AddressList::class, $message->getTo()); $this->assertCount(1, $message->getTo()); $this->assertEquals('*****@*****.**', $message->getTo()->current()->getEmail()); $message = new Message(); $message->addTo('*****@*****.**', 'example'); $this->assertEquals('*****@*****.**', $message->getTo()->current()->getEmail()); $this->assertEquals('example', $message->getTo()->current()->getName()); $message = new Message(); $message->addTo(array('*****@*****.**', '*****@*****.**')); $this->assertCount(2, $message->getTo()); $this->assertEquals('*****@*****.**', $message->getTo()->current()->getEmail()); $this->assertEquals('*****@*****.**', $message->getTo()->next()->getEmail()); $message = new Message(); $message->addTo(array('*****@*****.**' => 'example', '*****@*****.**')); $this->assertCount(2, $message->getTo()); $this->assertEquals('*****@*****.**', $message->getTo()->current()->getEmail()); $this->assertEquals('example', $message->getTo()->current()->getName()); $this->assertEquals('*****@*****.**', $message->getTo()->next()->getEmail()); $addresses = new AddressList(); $addresses->add('*****@*****.**'); $message = new Message(); $message->addTo($addresses); $this->assertEquals('*****@*****.**', $message->getTo()->current()->getEmail()); $address = new Address('*****@*****.**'); $message = new Message(); $message->addTo($address); $this->assertEquals('*****@*****.**', $message->getTo()->current()->getEmail()); }