Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'hotfix/4010'

Close #4010
  • Loading branch information...
commit 087f459f97ae5ee6acd81fa4371b05523ee99ff0 2 parents 0191f1f + b4b8793
@weierophinney weierophinney authored
View
3  library/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php
@@ -197,7 +197,8 @@ public function url($url, $method = HttpRequest::METHOD_GET, $params = array())
{
$request = $this->getRequest();
if ($this->useConsoleRequest) {
- $params = preg_split('#\s+#', $url);
+ preg_match_all('/(--\S+[= ]"\S*\s*\S*")|(--\S+=\S+|--\S+\s\S+|\S+)/', $url, $matches);
+ $params = str_replace(array(' "', '"'), array('=', ''), $matches[0]);
$request->params()->exchangeArray($params);
return $this;
}
View
18 tests/ZendTest/Test/PHPUnit/Controller/AbstractConsoleControllerTestCaseTest.php
@@ -94,4 +94,22 @@ public function testNotAssertConsoleOutputContains()
$this->setExpectedException('PHPUnit_Framework_ExpectationFailedException');
$this->assertNotConsoleOutputContains('foo');
}
+
+ public function testAssertMatchedArgumentsWithValue()
+ {
+ $this->dispatch('filter --date="2013-03-07 00:00:00" --id=10 --text="custom text"');
+ $routeMatch = $this->getApplication()->getMvcEvent()->getRouteMatch();
+ $this->assertEquals("2013-03-07 00:00:00", $routeMatch->getParam('date'));
+ $this->assertEquals("10", $routeMatch->getParam('id'));
+ $this->assertEquals("custom text", $routeMatch->getParam('text'));
+ }
+
+ public function testAssertMatchedArgumentsWithValueWithoutEqualsSign()
+ {
+ $this->dispatch('filter --date "2013-03-07 00:00:00" --id=10 --text="custom text"');
+ $routeMatch = $this->getApplication()->getMvcEvent()->getRouteMatch();
+ $this->assertEquals("2013-03-07 00:00:00", $routeMatch->getParam('date'));
+ $this->assertEquals("10", $routeMatch->getParam('id'));
+ $this->assertEquals("custom text", $routeMatch->getParam('text'));
+ }
}
View
10 tests/ZendTest/Test/_files/Baz/config/module.config.php
@@ -13,6 +13,16 @@
),
),
),
+ 'arguments' => array(
+ 'type' => 'simple',
+ 'options' => array(
+ 'route' => 'filter --date= --id= --text=',
+ 'defaults' => array(
+ 'controller' => 'baz_index',
+ 'action' => 'console',
+ ),
+ ),
+ ),
),
),
),
Please sign in to comment.
Something went wrong with that request. Please try again.