merged 2.0
This commit is contained in:
commit
0e525fc5ce
@ -827,6 +827,11 @@ class Application
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to figure out the terminal width in which this application runs
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
protected function getTerminalWidth()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && $ansicon = getenv('ANSICON')) {
|
||||
@ -838,6 +843,11 @@ class Application
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to figure out the terminal height in which this application runs
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
protected function getTerminalHeight()
|
||||
{
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD') && $ansicon = getenv('ANSICON')) {
|
||||
|
@ -285,8 +285,11 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSetCatchExceptions()
|
||||
{
|
||||
$application = new Application();
|
||||
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
|
||||
$application->setAutoExit(false);
|
||||
$application->expects($this->any())
|
||||
->method('getTerminalWidth')
|
||||
->will($this->returnValue(120));
|
||||
$tester = new ApplicationTester($application);
|
||||
|
||||
$application->setCatchExceptions(true);
|
||||
@ -323,8 +326,11 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testRenderException()
|
||||
{
|
||||
$application = new Application();
|
||||
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
|
||||
$application->setAutoExit(false);
|
||||
$application->expects($this->any())
|
||||
->method('getTerminalWidth')
|
||||
->will($this->returnValue(120));
|
||||
$tester = new ApplicationTester($application);
|
||||
|
||||
$tester->run(array('command' => 'foo'), array('decorated' => false));
|
||||
@ -348,6 +354,13 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue(32));
|
||||
$tester = new ApplicationTester($application);
|
||||
|
||||
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
|
||||
$application->setAutoExit(false);
|
||||
$application->expects($this->any())
|
||||
->method('getTerminalWidth')
|
||||
->will($this->returnValue(32));
|
||||
$tester = new ApplicationTester($application);
|
||||
|
||||
$tester->run(array('command' => 'foo'), array('decorated' => false));
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception4.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->renderException() wraps messages when they are bigger than the terminal');
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class RouteCollection implements \IteratorAggregate
|
||||
public function add($name, Route $route)
|
||||
{
|
||||
if (!preg_match('/^[a-z0-9A-Z_.]+$/', $name)) {
|
||||
throw new \InvalidArgumentException(sprintf('Name "%s" contains non valid characters for a route name.', $name));
|
||||
throw new \InvalidArgumentException(sprintf('The provided route name "%s" contains non valid characters. A route name must only contain digits (0-9), letters (a-z and A-Z), underscores (_) and dots (.).', $name));
|
||||
}
|
||||
|
||||
$parent = $this;
|
||||
|
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
[InvalidArgumentException]
|
||||
Command "foo" is not define
|
||||
d.
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user