SwiftTest.class.php 892 B

12345678910111213141516171819202122232425
  1. <?php
  2. /*
  3. use Silex\WebTestCase;
  4. class SwiftTest extends WebTestCase
  5. {
  6. public function createApplication()
  7. {
  8. $app = require dirname(__FILE__).'/../../../main/inc/global.inc.php';
  9. //$app["swiftmailer.transport"] = new \Swift_Transport_NullTransport($app['swiftmailer.transport.eventdispatcher']);
  10. //$app['mailer.logger'] = new Logger\MessageLogger();
  11. $app['mailer']->registerPlugin($app['monolog']);
  12. return $app;
  13. }
  14. public function testSend()
  15. {
  16. $client = $this->createClient();
  17. $crawler = $client->request('POST', '/', array("somedata"=>"to_send"));
  18. $this->assertEquals(1, $this->app['mailer.logger']->countMessages(), "Only one email sent");
  19. $emails = $this->app['mailer.logger']->getMessages();
  20. $this->assertEquals("This is my subject", $emails[0]->getSubject(), "Subject is correct");
  21. }
  22. }*/