Permalink
Browse files

add test checking that tests map to .. tests.

  • Loading branch information...
1 parent 71ce18d commit 27fa6a8cdda3c390863e7bcff53a1cd62be332a4 @AD7six AD7six committed Oct 18, 2011
Showing with 100 additions and 0 deletions.
  1. +100 −0 lib/Cake/Test/Case/Console/Command/TestShellTest.php
@@ -161,6 +161,106 @@ public function testMapPluginFileToCase() {
}
/**
+ * testMapCoreTestToCategory
+ *
+ * @return void
+ */
+ public function testMapCoreTestToCategory() {
+ $this->Shell->startup();
+
+ $return = $this->Shell->mapFileToCategory('lib/Cake/Test/Case/BasicsTest.php');
+ $this->assertSame('core', $return);
+
+ $return = $this->Shell->mapFileToCategory('lib/Cake/Test/Case/BasicsTest.php');
+ $this->assertSame('core', $return);
+
+ $return = $this->Shell->mapFileToCategory('lib/Cake/Test/Case/Some/Deeply/Nested/StructureTest.php');
+ $this->assertSame('core', $return);
+ }
+
+/**
+ * testMapCoreTestToCase
+ *
+ * basics.php is a slightly special case - it's the only file in the core with a test that isn't Capitalized
+ *
+ * @return void
+ */
+ public function testMapCoreTestToCase() {
+ $this->Shell->startup();
+
+ $return = $this->Shell->mapFileToCase('lib/Cake/Test/Case/BasicsTest.php', 'core');
+ $this->assertSame('Basics', $return);
+
+ $return = $this->Shell->mapFileToCase('lib/Cake/Test/Case/Core/AppTest.php', 'core');
+ $this->assertSame('Core/App', $return);
+
+ $return = $this->Shell->mapFileToCase('lib/Cake/Test/Case/Some/Deeply/Nested/StructureTest.php', 'core', false);
+ $this->assertSame('Some/Deeply/Nested/Structure', $return);
+ }
+
+/**
+ * testMapAppTestToCategory
+ *
+ * @return void
+ */
+ public function testMapAppTestToCategory() {
+ $this->Shell->startup();
+
+ $return = $this->Shell->mapFileToCategory(APP . 'Test/Case/Controller/ExampleControllerTest.php');
+ $this->assertSame('app', $return);
+
+ $return = $this->Shell->mapFileToCategory(APP . 'Test/Case/My/File/Is/HereTest.php');
+ $this->assertSame('app', $return);
+
+ }
+
+/**
+ * testMapAppTestToCase
+ *
+ * @return void
+ */
+ public function testMapAppTestToCase() {
+ $this->Shell->startup();
+
+ $return = $this->Shell->mapFileToCase(APP . 'Test/Case/Controller/ExampleControllerTest.php', 'app', false);
+ $this->assertSame('Controller/ExampleController', $return);
+
+ $return = $this->Shell->mapFileToCase(APP . 'Test/Case/My/File/Is/HereTest.php', 'app', false);
+ $this->assertSame('My/File/Is/Here', $return);
+ }
+
+/**
+ * testMapPluginTestToCategory
+ *
+ * @return void
+ */
+ public function testMapPluginTestToCategory() {
+ $this->Shell->startup();
+
+ $return = $this->Shell->mapFileToCategory(APP . 'Plugin/awesome/Test/Case/Controller/ExampleControllerTest.php');
+ $this->assertSame('awesome', $return);
+
+ $return = $this->Shell->mapFileToCategory(dirname(CAKE) . 'plugins/awesome/Test/Case/Controller/ExampleControllerTest.php');
+ $this->assertSame('awesome', $return);
+
+ }
+
+/**
+ * testMapPluginTestToCase
+ *
+ * @return void
+ */
+ public function testMapPluginTestToCase() {
+ $this->Shell->startup();
+
+ $return = $this->Shell->mapFileToCase(APP . 'Plugin/awesome/Test/Case/Controller/ExampleControllerTest.php', 'awesome', false);
+ $this->assertSame('Controller/ExampleController', $return);
+
+ $return = $this->Shell->mapFileToCase(dirname(CAKE) . 'plugins/awesome/Test/Case/Controller/ExampleControllerTest.php', 'awesome', false);
+ $this->assertSame('Controller/ExampleController', $return);
+ }
+
+/**
* test available list of test cases for an empty category
*
* @return void

0 comments on commit 27fa6a8

Please sign in to comment.