From d810b43e80376d7e8a80adb68e07446a00e5970e Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 7 Jun 2009 12:22:43 -0400 Subject: [PATCH] Adding tests so no empty helpers/components can be added. Refs #6383 --- cake/console/libs/tasks/controller.php | 2 +- .../cases/console/libs/tasks/controller.test.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index 1feffb840..770a94cc8 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -373,7 +373,7 @@ class ControllerTask extends Shell { $propertyListTrimmed = str_replace(' ', '', $propertyList); $property = explode(',', $propertyListTrimmed); } - return $property; + return array_filter($property); } /** diff --git a/cake/tests/cases/console/libs/tasks/controller.test.php b/cake/tests/cases/console/libs/tasks/controller.test.php index 0cd154c8c..48c125ce4 100644 --- a/cake/tests/cases/console/libs/tasks/controller.test.php +++ b/cake/tests/cases/console/libs/tasks/controller.test.php @@ -181,6 +181,12 @@ class ControllerTaskTest extends CakeTestCase { $result = $this->Task->doHelpers(); $expected = array('Javascript', 'Ajax', 'CustomOne'); $this->assertEqual($result, $expected); + + $this->Task->setReturnValueAt(3, 'in', 'y'); + $this->Task->setReturnValueAt(4, 'in', ' Javascript, Ajax, CustomOne, , '); + $result = $this->Task->doHelpers(); + $expected = array('Javascript', 'Ajax', 'CustomOne'); + $this->assertEqual($result, $expected); } /** @@ -198,6 +204,12 @@ class ControllerTaskTest extends CakeTestCase { $result = $this->Task->doComponents(); $expected = array('RequestHandler', 'Security'); $this->assertEqual($result, $expected); + + $this->Task->setReturnValueAt(3, 'in', 'y'); + $this->Task->setReturnValueAt(4, 'in', ' RequestHandler, Security, , '); + $result = $this->Task->doComponents(); + $expected = array('RequestHandler', 'Security'); + $this->assertEqual($result, $expected); } /**