ソースを参照

Fix failing more tests on windows.

* Windows doesn't support info log level.
* Windows needs assertTextEquals()
* Windows has different opinions on invalid dates.
mark_story 11 年 前
コミット
7b0179b80a

+ 7 - 7
tests/TestCase/Console/Command/CompletionShellTest.php

@@ -113,7 +113,7 @@ class CompletionShellTest extends TestCase {
 		$output = $this->out->output;
 		$output = $this->out->output;
 
 
 		$expected = "TestPlugin.example TestPluginTwo.example TestPluginTwo.welcome bake i18n orm_cache server test sample\n";
 		$expected = "TestPlugin.example TestPluginTwo.example TestPluginTwo.welcome bake i18n orm_cache server test sample\n";
-		$this->assertEquals($expected, $output);
+		$this->assertTextEquals($expected, $output);
 	}
 	}
 
 
 /**
 /**
@@ -126,7 +126,7 @@ class CompletionShellTest extends TestCase {
 		$output = $this->out->output;
 		$output = $this->out->output;
 
 
 		$expected = "--help -h --verbose -v --quiet -q\n";
 		$expected = "--help -h --verbose -v --quiet -q\n";
-		$this->assertEquals($expected, $output);
+		$this->assertTextEquals($expected, $output);
 	}
 	}
 
 
 /**
 /**
@@ -139,7 +139,7 @@ class CompletionShellTest extends TestCase {
 		$output = $this->out->output;
 		$output = $this->out->output;
 
 
 		$expected = "--help -h --verbose -v --quiet -q\n";
 		$expected = "--help -h --verbose -v --quiet -q\n";
-		$this->assertEquals($expected, $output);
+		$this->assertTextEquals($expected, $output);
 	}
 	}
 
 
 /**
 /**
@@ -152,7 +152,7 @@ class CompletionShellTest extends TestCase {
 		$output = $this->out->output;
 		$output = $this->out->output;
 
 
 		$expected = "--help -h --verbose -v --quiet -q --connection -c --theme -t\n";
 		$expected = "--help -h --verbose -v --quiet -q --connection -c --theme -t\n";
-		$this->assertEquals($expected, $output);
+		$this->assertTextEquals($expected, $output);
 	}
 	}
 
 
 /**
 /**
@@ -165,7 +165,7 @@ class CompletionShellTest extends TestCase {
 		$output = $this->out->output;
 		$output = $this->out->output;
 
 
 		$expected = "behavior cell component controller fixture helper model plugin project shell test view widget zerg\n";
 		$expected = "behavior cell component controller fixture helper model plugin project shell test view widget zerg\n";
-		$this->assertEquals($expected, $output);
+		$this->assertTextEquals($expected, $output);
 	}
 	}
 
 
 /**
 /**
@@ -191,7 +191,7 @@ class CompletionShellTest extends TestCase {
 		$output = $this->out->output;
 		$output = $this->out->output;
 
 
 		$expected = "say_hello\n";
 		$expected = "say_hello\n";
-		$this->assertEquals($expected, $output);
+		$this->assertTextEquals($expected, $output);
 	}
 	}
 
 
 /**
 /**
@@ -230,7 +230,7 @@ class CompletionShellTest extends TestCase {
 		$output = $this->out->output;
 		$output = $this->out->output;
 
 
 		$expected = "behavior cell component controller fixture helper model plugin project shell test view widget zerg\n";
 		$expected = "behavior cell component controller fixture helper model plugin project shell test view widget zerg\n";
-		$this->assertEquals($expected, $output);
+		$this->assertTextEquals($expected, $output);
 	}
 	}
 
 
 /**
 /**

+ 1 - 1
tests/TestCase/Console/Command/Task/ExtractTaskTest.php

@@ -67,7 +67,7 @@ class ExtractTaskTest extends TestCase {
 	public function testExecute() {
 	public function testExecute() {
 		$this->Task->interactive = false;
 		$this->Task->interactive = false;
 
 
-		$this->Task->params['paths'] = TEST_APP . 'TestApp/Template/Pages';
+		$this->Task->params['paths'] = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages';
 		$this->Task->params['output'] = $this->path . DS;
 		$this->Task->params['output'] = $this->path . DS;
 		$this->Task->params['extract-core'] = 'no';
 		$this->Task->params['extract-core'] = 'no';
 		$this->Task->expects($this->never())->method('err');
 		$this->Task->expects($this->never())->method('err');

+ 6 - 6
tests/TestCase/Log/LogTest.php

@@ -315,12 +315,12 @@ class LogTest extends TestCase {
 		$this->_resetLogConfig();
 		$this->_resetLogConfig();
 		Log::config('shops', array(
 		Log::config('shops', array(
 			'engine' => 'File',
 			'engine' => 'File',
-			'types' => array('info', 'notice', 'warning'),
+			'types' => array('info', 'debug', 'warning'),
 			'scopes' => array('transactions', 'orders'),
 			'scopes' => array('transactions', 'orders'),
 			'file' => 'shops',
 			'file' => 'shops',
 		));
 		));
 
 
-		Log::write('info', 'info message', 'transactions');
+		Log::write('debug', 'debug message', 'transactions');
 		$this->assertFileNotExists(LOGS . 'error.log');
 		$this->assertFileNotExists(LOGS . 'error.log');
 		$this->assertFileExists(LOGS . 'shops.log');
 		$this->assertFileExists(LOGS . 'shops.log');
 		$this->assertFileExists(LOGS . 'debug.log');
 		$this->assertFileExists(LOGS . 'debug.log');
@@ -400,24 +400,24 @@ class LogTest extends TestCase {
 
 
 		Log::config('shops', array(
 		Log::config('shops', array(
 			'engine' => 'File',
 			'engine' => 'File',
-			'types' => array('info', 'notice', 'warning'),
+			'types' => array('debug', 'notice', 'warning'),
 			'scopes' => array('transactions', 'orders'),
 			'scopes' => array('transactions', 'orders'),
 			'file' => 'shops.log',
 			'file' => 'shops.log',
 		));
 		));
 		Log::config('eggs', array(
 		Log::config('eggs', array(
 			'engine' => 'File',
 			'engine' => 'File',
-			'types' => array('info', 'notice', 'warning'),
+			'types' => array('debug', 'notice', 'warning'),
 			'scopes' => array('eggs'),
 			'scopes' => array('eggs'),
 			'file' => 'eggs.log',
 			'file' => 'eggs.log',
 		));
 		));
 
 
-		Log::write('info', 'transactions message', 'transactions');
+		Log::write('debug', 'transactions message', 'transactions');
 		$this->assertFileNotExists(LOGS . 'eggs.log');
 		$this->assertFileNotExists(LOGS . 'eggs.log');
 		$this->assertFileExists(LOGS . 'shops.log');
 		$this->assertFileExists(LOGS . 'shops.log');
 
 
 		$this->_deleteLogs();
 		$this->_deleteLogs();
 
 
-		Log::write('info', 'eggs message', 'eggs');
+		Log::write('debug', 'eggs message', 'eggs');
 		$this->assertFileExists(LOGS . 'eggs.log');
 		$this->assertFileExists(LOGS . 'eggs.log');
 		$this->assertFileNotExists(LOGS . 'shops.log');
 		$this->assertFileNotExists(LOGS . 'shops.log');
 	}
 	}

+ 16 - 2
tests/TestCase/Utility/TimeTest.php

@@ -560,8 +560,6 @@ class TimeTest extends TestCase {
 			[null],
 			[null],
 			[false],
 			[false],
 			[''],
 			[''],
-			['0000-00-00'],
-			['0000-00-00 00:00:00'],
 		];
 		];
 	}
 	}
 
 
@@ -578,6 +576,22 @@ class TimeTest extends TestCase {
 	}
 	}
 
 
 /**
 /**
+ * These invalid values are not invalid on windows :(
+ *
+ * @return void
+ */
+	public function testToStringInvalidZeros() {
+		$this->skipIf(DS === '\\', 'All zeros are valid on windows.');
+		$time = new Time('0000-00-00');
+		$this->assertInternalType('string', (string)$time);
+		$this->assertNotEmpty((string)$time);
+
+		$time = new Time('0000-00-00 00:00:00');
+		$this->assertInternalType('string', (string)$time);
+		$this->assertNotEmpty((string)$time);
+	}
+
+/**
  * Tests diffForHumans
  * Tests diffForHumans
  *
  *
  * @return void
  * @return void