Skip to content

Instantly share code, notes, and snippets.

@gmorel
Last active April 17, 2018 11:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmorel/5d3030249423aa6eeebe to your computer and use it in GitHub Desktop.
Save gmorel/5d3030249423aa6eeebe to your computer and use it in GitHub Desktop.
Symfony Console wideness issue
<?php
/*
* This file allow to test that the console wideness influence
* the way the console output is displayed
*/
namespace Symfony\Component\Console\Tests\Tester;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Tester\ApplicationTester;
class ApplicationTesterTest extends \PHPUnit_Framework_TestCase
{
protected $application;
protected $tester;
protected function setUp()
{
$this->application = new Application();
$this->application->setAutoExit(false);
$this->application->register('foo')
->addArgument('foo')
->setCode(function ($input, $output) { throw new \Exception('"since" or "ids" or "emails" options must not be setted when from-redis is true.'); })
;
$this->tester = new ApplicationTester($this->application);
$this->tester->run(array('command' => 'foo', 'foo' => 'bar'), array('interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE));
}
protected function tearDown()
{
$this->application = null;
$this->tester = null;
}
public function testGetOutputWideness()
{
rewind($this->tester->getOutput()->getStream());
$this->assertContains('"since" or "ids" or "emails" options must not be setted when from-redis is true.', stream_get_contents($this->tester->getOutput()->getStream()));
}
public function testGetDisplayWideness()
{
$this->assertContains('"since" or "ids" or "emails" options must not be setted when from-redis is true.', $this->tester->getDisplay());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment