ソースを参照

skip session tests in cli

euromark 13 年 前
コミット
dfa167d18f

+ 1 - 1
Test/Case/Controller/Component/CommonComponentTest.php

@@ -9,7 +9,7 @@ App::uses('AppController', 'Controller');
  */
 class CommonComponentTest extends CakeTestCase {
 
-	public $fixtures = array('core.cake_session');
+	//public $fixtures = array('core.cake_session');
 
 /**
  * setUp method

+ 3 - 5
Test/Case/Lib/AuthTest.php

@@ -11,6 +11,8 @@ class AuthTest extends MyCakeTestCase {
 
 	public function setUp() {
 		ClassRegistry::init('Session');
+
+		$this->skipIf(php_sapi_name() === 'cli', 'Cannot test session in CLI');
 	}
 
 	public function tearDown() {
@@ -21,8 +23,7 @@ class AuthTest extends MyCakeTestCase {
 
 	public function testId() {
 		$id = Auth::id();
-		// can also be false if session cannot be started
-		$this->assertTrue($id === null || $id === false);
+		$this->assertNull($id);
 
 		CakeSession::write('Auth.User.id', 1);
 		$id = Auth::id();
@@ -84,7 +85,4 @@ class AuthTest extends MyCakeTestCase {
 		$this->assertFalse($res);
 	}
 
-
-
-
 }