Last active
April 17, 2018 11:57
-
-
Save gmorel/5d3030249423aa6eeebe to your computer and use it in GitHub Desktop.
Symfony Console wideness issue
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 | |
/* | |
* 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