Created
January 18, 2013 14:47
-
-
Save dlondero/4565028 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\DemoBundle\Tests\Command; | |
use Symfony\Component\Console\Tester\CommandTester; | |
use Symfony\Bundle\FrameworkBundle\Console\Application; | |
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
use Acme\DemoBundle\Command\EmailCommand; | |
class EmailCommandTest extends WebTestCase | |
{ | |
public function testExecute() | |
{ | |
$client = self::createClient(); | |
$application = new Application($client->getKernel()); | |
$application->add(new EmailCommand()); | |
$command = $application->find('demo:email'); | |
$commandTester = new CommandTester($command); | |
$commandTester->execute(array('command' => $command->getName())); | |
$this->assertRegExp('/Email sent/', $commandTester->getDisplay()); | |
$container = $client->getKernel()->getContainer(); | |
$profiler = $container->get('profiler'); | |
$mailerCollector = $profiler->get('swiftmailer'); | |
var_dump($mailerCollector->getMessages()); | |
$mailerLogger = $container->get('swiftmailer.plugin.messagelogger'); | |
var_dump($mailerLogger->getMessages()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment