8000 merged 2.0 · gbenoit79/symfony@0e525fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e525fc

Browse files
committed
merged 2.0
2 parents c6096e3 + 38e17c2 commit 0e525fc

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,11 @@ public function renderException($e, $output)
827827
}
828828
}
829829

830+
/**
831+
* Tries to figure out the terminal width in which this application runs
832+
*
833+
* @return int|null
834+
*/
830835
protected function getTerminalWidth()
831836
{
832837
if (defined('PHP_WINDOWS_VERSION_BUILD') && $ansicon = getenv('ANSICON')) {
@@ -838,6 +843,11 @@ protected function getTerminalWidth()
838843
}
839844
}
840845

846+
/**
847+
* Tries to figure out the terminal height in which this application runs
848+
*
849+
* @return int|null
850+
*/
841851
protected function getTerminalHeight()
842852
{
843853
if (defined('PHP_WINDOWS_VERSION_BUILD') && $ansicon = getenv('ANSICON')) {

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,11 @@ public function testFindAlternativeNamespace()
285285

286286
public function testSetCatchExceptions()
287287
{
288-
$application = new Application();
288+
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
289289
$application->setAutoExit(false);
290+
$application->expects($this->any())
291+
->method('getTerminalWidth')
292+
->will($this->returnValue(120));
290293
$tester = new ApplicationTester($application);
291294

292295
$application->setCatchExceptions(true);
@@ -323,8 +326,11 @@ public function testAsXml()
323326

324327
public function testRenderException()
325328
{
326-
$application = new Application();
329+
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
327330
$application->setAutoExit(false);
331+
$application->expects($this->any())
332+
->method('getTerminalWidth')
333+
->will($this->returnValue(120));
328334
$tester = new ApplicationTester($application);
329335

330336
$tester->run(array('command' => 'foo'), array('decorated' => false));
@@ -348,6 +354,13 @@ public function testRenderException()
348354
->will($this->returnValue(32));
349355
$tester = new ApplicationTester($application);
350356

357+
$application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
358+
$application->setAutoExit(false);
359+
$application->expects($this->any())
360+
->method('getTerminalWidth')
361+
->will($this->returnValue(32));
362+
$tester = new ApplicationTester($application);
363+
351364
$tester->run(array('command' => 'foo'), array('decorated' => false));
352365
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception4.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->renderException() wraps messages when they are bigger than the terminal');
353366
}

src/Symfony/Component/Routing/RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getIterator()
9595
public function add($name, Route $route)
9696
{
9797
if (!preg_match('/^[a-z0-9A-Z_.]+$/', $name)) {
98-
throw new \InvalidArgumentException(sprintf('Name "%s" contains non valid characters for a route name.', $name));
98+
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));
9999
}
100100

101101
$parent = $this;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
4+
[InvalidArgumentException]
5+
Command "foo" is not define
6+
d.
7+
8+
9+

0 commit comments

Comments
 (0)
0