Beispiel #1
0
    public function testReturnPath()
    {
        $mail = new Mail\Mail();
        $res = $mail->setBodyText('This is a test.');
        $mail->setFrom('*****@*****.**', 'test Mail User');
        $mail->setSubject('My Subject');
        $mail->addTo('*****@*****.**');
        $mail->addTo('*****@*****.**');
        $mail->addBcc('*****@*****.**');
        $mail->addBcc('*****@*****.**');
        $mail->addCc('*****@*****.**', 'Example no. 1 for cc');
        $mail->addCc('*****@*****.**', 'Example no. 2 for cc');

        // First example: from and return-path should be equal
        $mock = new TransportMock();
        $mail->send($mock);
        $this->assertTrue($mock->called);
        $this->assertEquals($mail->getFrom(), $mock->returnPath);

        // Second example: from and return-path should not be equal
        $mail->setReturnPath('*****@*****.**');
        $mock = new TransportMock();
        $mail->send($mock);
        $this->assertTrue($mock->called);
        $this->assertNotEquals($mail->getFrom(), $mock->returnPath);
        $this->assertEquals($mail->getReturnPath(), $mock->returnPath);
        $this->assertNotEquals($mock->returnPath, $mock->from);
    }