Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding test case for previous commit.

Fixing function for non-windows paths.
  • Loading branch information...
commit adaa2b689c35869052c6b218011516d77a7d2f0d 1 parent c810b3c
@markstory markstory authored
View
3  cake/console/libs/tasks/project.php
@@ -224,7 +224,8 @@ function corePath($path) {
$File =& new File($path . 'webroot' . DS . 'index.php');
$contents = $File->read();
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
- $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', ". (strpos(CAKE_CORE_INCLUDE_PATH, '/')===0? " DS . '":"'") . str_replace('/', '\' . DS . \'', trim(CAKE_CORE_INCLUDE_PATH, '/')) . "');", $contents);
+ $root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " DS . '" : "'";
+ $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', " . $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "');", $contents);
if (!$File->write($result)) {
return false;
}
View
16 cake/tests/cases/console/libs/tasks/project.test.php
@@ -131,6 +131,22 @@ function testSecuritySaltGeneration() {
}
/**
+ * Test that index.php is generated correctly.
+ *
+ * @return void
+ **/
+ function testIndexPhpGeneration() {
+ $this->_setupTestProject();
+
+ $path = $this->Task->path . 'bake_test_app' . DS;
+ $this->Task->corePath($path);
+
+ $file =& new File($path . 'webroot' . DS . 'index.php');
+ $contents = $file->read();
+ $this->assertNoPattern('/define\(\'CAKE_CORE_INCLUDE_PATH\', \'ROOT/', $contents);
+ }
+
+/**
* test getPrefix method, and that it returns Routing.prefix or writes to config file.
*
* @return void
Please sign in to comment.
Something went wrong with that request. Please try again.