public function testSendListenerIsNotifiedOnSend() { $listener = new MockSendListener(); $listener->expectOnce("sendPerformed"); $conn = $this->getWorkingMockConnection(1); $message = new Swift_Message("Subject", "Body"); $swift = new Swift($conn); $swift->attachPlugin($listener, "myplugin"); $swift->send($message, new Swift_Address("*****@*****.**"), new Swift_Address("*****@*****.**")); $listener = new MockSendListener(); $listener->expectCallCount("sendPerformed", 5); $conn = $this->getWorkingMockConnection(5); $message = new Swift_Message("Subject", "Body"); $swift = new Swift($conn); $swift->attachPlugin($listener, "myplugin"); for ($i = 0; $i < 5; $i++) { $swift->send($message, new Swift_Address("*****@*****.**"), new Swift_Address("*****@*****.**")); } }
/** * EasySwift loads plugins in the manner of the old API but simply wraps around the new API. */ public function testPluginsAreLoadedWithEasySwiftButHandledBySwiftAsNormal() { $conn = $this->getWorkingMockConnection(); $swift = new EasySwift($conn); $plugin = new MockSendListener(); $plugin->expectOnce("sendPerformed"); $swift->loadPlugin($plugin, "myplugin"); $swift->send("*****@*****.**", "*****@*****.**", "Subject", "body"); }