Browse Source

Added tests for bake shell cache prefix generation

Tigran Gabrielyan 14 years ago
parent
commit
0441c9f6c3
1 changed files with 18 additions and 0 deletions
  1. 18 0
      lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php

+ 18 - 0
lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php

@@ -250,6 +250,24 @@ class ProjectTaskTest extends CakeTestCase {
 	}
 
 /**
+ * test generation of cache prefix
+ *
+ * @return void
+ */
+	public function testCachePrefixGeneration() {
+		$this->_setupTestProject();
+
+		$path = $this->Task->path . 'bake_test_app' . DS;
+		$result = $this->Task->cachePrefix($path);
+		$this->assertTrue($result);
+
+		$File = new File($path . 'Config' . DS . 'core.php');
+		$contents = $File->read();
+		$this->assertRegExp('/\$prefix = \'.+\';/', $contents, '$prefix is not defined');
+		$this->assertNotRegExp('/\$prefix = \'myapp_\';/', $contents, 'Default cache prefix left behind. %s');
+	}
+
+/**
  * Test that index.php is generated correctly.
  *
  * @return void