Permalink
Browse files

add a couple of tests for detecting the right app file

  • Loading branch information...
1 parent 6ab5f1f commit f82ae6679024b0d784e3cf6c3cb732e64b5dbb88 @AD7six AD7six committed Oct 18, 2011
Showing with 25 additions and 2 deletions.
  1. +1 −1 lib/Cake/Console/Command/TestShell.php
  2. +24 −1 lib/Cake/Test/Case/Console/Command/TestShellTest.php
@@ -405,7 +405,7 @@ protected function _mapFileToCase($file, $category, $throwOnMissingFile = true)
throw new Exception(__d('cake_dev', 'Test case %s not found', $testFile));
}
- $testCase = substr($file, 0, -8);
+ $testCase = substr($testFile, 0, -8);
$testCase = str_replace(DS, '/', $testCase);
$testCase = preg_replace('@.*Test/Case/@', '', $testCase);
@@ -62,7 +62,6 @@ public function tearDown() {
/**
* testMapCoreFileToCategory
- *
*
* @return void
*/
@@ -100,6 +99,30 @@ public function testMapCoreFileToCase() {
}
/**
+ * testMapAppFileToCategory
+ *
+ * @return void
+ */
+ public function testMapAppFileToCategory() {
+ $this->Shell->startup();
+
+ $return = $this->Shell->mapFileToCategory('Controller/ExampleController.php');
+ $this->assertSame('app', $return);
+ }
+
+/**
+ * testMapAppFileToCase
+ *
+ * @return void
+ */
+ public function testMapAppFileToCase() {
+ $this->Shell->startup();
+
+ $return = $this->Shell->mapFileToCase('Controller/ExampleController.php', 'app', false);
+ $this->assertSame('Controller/ExampleController', $return);
+ }
+
+/**
* test available list of test cases for an empty category
*
* @return void

0 comments on commit f82ae66

Please sign in to comment.