Skip to content

Commit

Permalink
Fixing some Shell tests for Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed May 9, 2010
1 parent b8a98e2 commit 501a237
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cake/tests/cases/console/libs/shell.test.php
Expand Up @@ -292,7 +292,9 @@ function testShortPath() {
* @access public
*/
function testCreateFile() {
$this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Not supported on Windows');
if ($this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Not supported on Windows')) {
return;
}

$path = TMP . 'shell_test';
$file = $path . DS . 'file1.php';
Expand Down Expand Up @@ -342,7 +344,9 @@ function testCreateFile() {
* @access public
*/
function testCreateFileWindows() {
$this->skipUnless(DIRECTORY_SEPARATOR === '\\', '%s Supported on Windows only');
if ($this->skipUnless(DIRECTORY_SEPARATOR === '\\', '%s Supported on Windows only')) {
return;
}

$path = TMP . 'shell_test';
$file = $path . DS . 'file1.php';
Expand All @@ -351,13 +355,13 @@ function testCreateFileWindows() {

$this->Shell->interactive = false;

$contents = "<?php\necho 'test';\r\n\$te = 'st';\r\n?>";
$contents = "<?php\r\necho 'test';\r\n\$te = 'st';\r\n?>";
$result = $this->Shell->createFile($file, $contents);
$this->assertTrue($result);
$this->assertTrue(file_exists($file));
$this->assertEqual(file_get_contents($file), $contents);

$contents = "<?php\necho 'another test';\r\n\$te = 'st';\r\n?>";
$contents = "<?php\r\necho 'another test';\r\n\$te = 'st';\r\n?>";
$result = $this->Shell->createFile($file, $contents);
$this->assertTrue($result);
$this->assertTrue(file_exists($file));
Expand All @@ -368,7 +372,7 @@ function testCreateFileWindows() {
$this->Shell->Dispatch->setReturnValueAt(0, 'getInput', 'n');
$this->Shell->Dispatch->expectAt(1, 'stdout', array('File exists, overwrite?'));

$contents = "<?php\necho 'yet another test';\r\n\$te = 'st';\r\n?>";
$contents = "<?php\r\necho 'yet another test';\r\n\$te = 'st';\r\n?>";
$result = $this->Shell->createFile($file, $contents);
$this->assertFalse($result);
$this->assertTrue(file_exists($file));
Expand Down

0 comments on commit 501a237

Please sign in to comment.