Merge pull request #132 from php-flasher/test/envelope

test: add more envelope tests
This commit is contained in:
Younes KHOUBZA
2023-02-01 00:20:14 +01:00
committed by GitHub
+20 -1
View File
@@ -321,8 +321,27 @@ final class EnvelopeTest extends TestCase
$notification = $this->getMockBuilder('Flasher\Prime\Notification\NotificationInterface')->getMock();
$notification->expects($this->once())->method('toArray')->willReturn($array);
$envelope = new Envelope($notification, new HandlerStamp('flasher'));
$this->assertEquals(array('notification' => $array, 'handler' => 'flasher'), $envelope->toArray());
}
/**
* @return void
*/
public function testCallDynamicCallToNotification()
{
$notification = new DynamicNotification();
$envelope = new Envelope($notification);
$this->assertEquals(array('notification' => $array), $envelope->toArray());
$this->assertEquals('foobar', $envelope->foo());
}
}
class DynamicNotification extends Notification
{
public function foo()
{
return 'foobar';
}
}