From e71d83c612087e0aa1dde257bfc3d067a7f9959d Mon Sep 17 00:00:00 2001 From: nojimage Date: Mon, 8 Aug 2016 20:09:37 +0900 Subject: [PATCH 1/2] TestShell passes the 'directive' option to PHPUnit correctly --- lib/Cake/Console/Command/TestShell.php | 7 ++++++- .../Case/Console/Command/TestShellTest.php | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Console/Command/TestShell.php b/lib/Cake/Console/Command/TestShell.php index 4dfacfdfc..4c8db6234 100644 --- a/lib/Cake/Console/Command/TestShell.php +++ b/lib/Cake/Console/Command/TestShell.php @@ -152,6 +152,7 @@ class TestShell extends Shell { 'default' => false ))->addOption('directive', array( 'help' => __d('cake_console', 'key[=value] Sets a php.ini value.'), + 'short' => 'd', 'default' => false ))->addOption('fixture', array( 'help' => __d('cake_console', 'Choose a custom fixture manager.') @@ -234,7 +235,11 @@ class TestShell extends Shell { if ($value === false) { continue; } - $options[] = '--' . $param; + if ($param === 'directive') { + $options[] = '-d'; + } else { + $options[] = '--' . $param; + } if (is_string($value)) { $options[] = $value; } diff --git a/lib/Cake/Test/Case/Console/Command/TestShellTest.php b/lib/Cake/Test/Case/Console/Command/TestShellTest.php index d3d379a1d..bcc100628 100644 --- a/lib/Cake/Test/Case/Console/Command/TestShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/TestShellTest.php @@ -359,4 +359,22 @@ class TestShellTest extends CakeTestCase { ); $this->Shell->main(); } + +/** + * Tests that the '--directive' parameter change to '-d' before calling PHPUnit + * + * @return void + */ + public function testRunnerOptionsDirective() { + $this->Shell->startup(); + $this->Shell->args = array('core', 'Basics'); + $this->Shell->params = array('directive' => 'memory_limit=128M'); + + $this->Shell->expects($this->once())->method('_run') + ->with( + array('app' => false, 'plugin' => null, 'core' => true, 'output' => 'text', 'case' => 'Basics'), + array('-d', 'memory_limit=128M', '--colors') + ); + $this->Shell->main(); + } } From 9a5d5705cd1947f551d35514a3f0e2550e511111 Mon Sep 17 00:00:00 2001 From: nojimage Date: Mon, 8 Aug 2016 20:13:40 +0900 Subject: [PATCH 2/2] TestShell support --coverage-text option --- lib/Cake/Console/Command/TestShell.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Cake/Console/Command/TestShell.php b/lib/Cake/Console/Command/TestShell.php index 4c8db6234..29eca2721 100644 --- a/lib/Cake/Console/Command/TestShell.php +++ b/lib/Cake/Console/Command/TestShell.php @@ -71,6 +71,9 @@ class TestShell extends Shell { ))->addOption('coverage-clover', array( 'help' => __d('cake_console', ' Write code coverage data in Clover XML format.'), 'default' => false + ))->addOption('coverage-text', array( + 'help' => __d('cake_console', 'Output code coverage report in Text format.'), + 'boolean' => true ))->addOption('testdox-html', array( 'help' => __d('cake_console', ' Write agile documentation in HTML format to file.'), 'default' => false