Skip to content
Permalink
Browse files

Fixing some Shell tests for Windows.

  • Loading branch information...
jrbasso committed May 9, 2010
1 parent b8a98e2 commit 501a237053dd5946e9008e747a4ccfb0cb1bf8ed
Showing with 9 additions and 5 deletions.
  1. +9 −5 cake/tests/cases/console/libs/shell.test.php
@@ -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';
@@ -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';
@@ -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));
@@ -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));

0 comments on commit 501a237

Please sign in to comment.
You can’t perform that action at this time.