Converting assertions to not use compatibility wrappers.

This commit is contained in:
mark_story 2010-12-10 22:03:53 -05:00
parent 106c1185b4
commit daf6084ccc

View file

@ -136,10 +136,10 @@ class CakeSessionTest extends CakeTestCase {
*/
function testSessionPath() {
TestCakeSession::init('/index.php');
$this->assertEqual('/', TestCakeSession::$path);
$this->assertEquals(TestCakeSession::$path, '/');
TestCakeSession::init('/sub_dir/index.php');
$this->assertEqual('/sub_dir/', TestCakeSession::$path);
$this->assertEquals(TestCakeSession::$path, '/sub_dir/');
}
/**
@ -150,7 +150,7 @@ class CakeSessionTest extends CakeTestCase {
*/
function testCakeSessionPathEmpty() {
TestCakeSession::init('');
$this->assertEqual('/', TestCakeSession::$path, 'Session path is empty, with "" as $base needs to be / %s');
$this->assertEquals(TestCakeSession::$path, '/', 'Session path is empty, with "" as $base needs to be /');
}
/**
@ -161,7 +161,7 @@ class CakeSessionTest extends CakeTestCase {
*/
function testCakeSessionPathContainsQuestion() {
TestCakeSession::init('/index.php?');
$this->assertEqual('/', TestCakeSession::$path);
$this->assertEquals(TestCakeSession::$path, '/');
}
/**
@ -173,7 +173,7 @@ class CakeSessionTest extends CakeTestCase {
function testSetHost() {
TestCakeSession::init();
TestCakeSession::setHost('cakephp.org');
$this->assertEqual('cakephp.org', TestCakeSession::$host);
$this->assertEquals(TestCakeSession::$host, 'cakephp.org');
}
/**
@ -185,7 +185,7 @@ class CakeSessionTest extends CakeTestCase {
function testSetHostWithPort() {
TestCakeSession::init();
TestCakeSession::setHost('cakephp.org:443');
$this->assertEqual('cakephp.org', TestCakeSession::$host);
$this->assertEquals(TestCakeSession::$host, 'cakephp.org');
}
/**
@ -238,14 +238,14 @@ class CakeSessionTest extends CakeTestCase {
function testSimpleRead() {
TestCakeSession::write('testing', '1,2,3');
$result = TestCakeSession::read('testing');
$this->assertEqual($result, '1,2,3');
$this->assertEquals('1,2,3', $result);
TestCakeSession::write('testing', array('1' => 'one', '2' => 'two','3' => 'three'));
$result = TestCakeSession::read('testing.1');
$this->assertEqual($result, 'one');
$this->assertEquals('one', $result);
$result = TestCakeSession::read('testing');
$this->assertEqual($result, array('1' => 'one', '2' => 'two', '3' => 'three'));
$this->assertEquals(array('1' => 'one', '2' => 'two', '3' => 'three'), $result);
$result = TestCakeSession::read();
$this->assertTrue(isset($result['testing']));
@ -254,7 +254,7 @@ class CakeSessionTest extends CakeTestCase {
TestCakeSession::write('This.is.a.deep.array.my.friend', 'value');
$result = TestCakeSession::read('This.is.a.deep.array.my.friend');
$this->assertEqual('value', $result);
$this->assertEquals($result, 'value');
}
/**
@ -340,11 +340,11 @@ class CakeSessionTest extends CakeTestCase {
function testError() {
TestCakeSession::read('Does.not.exist');
$result = TestCakeSession::error();
$this->assertEqual($result, "Does.not.exist doesn't exist");
$this->assertEquals("Does.not.exist doesn't exist", $result);
TestCakeSession::delete('Failing.delete');
$result = TestCakeSession::error();
$this->assertEqual($result, "Failing.delete doesn't exist");
$this->assertEquals("Failing.delete doesn't exist", $result);
}
/**
@ -449,7 +449,7 @@ class CakeSessionTest extends CakeTestCase {
*/
function testCheckKeyWithSpaces() {
$this->assertTrue(TestCakeSession::write('Session Test', "test"));
$this->assertEqual(TestCakeSession::check('Session Test'), 'test');
$this->assertEquals('test', TestCakeSession::check('Session Test'));
TestCakeSession::delete('Session Test');
$this->assertTrue(TestCakeSession::write('Session Test.Test Case', "test"));
@ -477,7 +477,7 @@ class CakeSessionTest extends CakeTestCase {
$this->assertTrue($result);
$result = TestCakeSession::read($key);
$this->assertEqual($result, 'haxored');
$this->assertEquals('haxored', $result);
}
/**
@ -488,17 +488,17 @@ class CakeSessionTest extends CakeTestCase {
*/
function testReadingSavedEmpty() {
TestCakeSession::write('SessionTestCase', 0);
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 0);
$this->assertEquals(0, TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', '0');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), '0');
$this->assertEquals('0', TestCakeSession::read('SessionTestCase'));
$this->assertFalse(TestCakeSession::read('SessionTestCase') === 0);
TestCakeSession::write('SessionTestCase', false);
$this->assertFalse(TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', null);
$this->assertEqual(TestCakeSession::read('SessionTestCase'), null);
$this->assertEquals(null, TestCakeSession::read('SessionTestCase'));
}
/**
@ -542,24 +542,24 @@ class CakeSessionTest extends CakeTestCase {
TestCakeSession::start();
TestCakeSession::write('SessionTestCase', 0);
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 0);
$this->assertEquals(0, TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', '0');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), '0');
$this->assertEquals('0', TestCakeSession::read('SessionTestCase'));
$this->assertFalse(TestCakeSession::read('SessionTestCase') === 0);
TestCakeSession::write('SessionTestCase', false);
$this->assertFalse(TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', null);
$this->assertEqual(TestCakeSession::read('SessionTestCase'), null);
$this->assertEquals(null, TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', 'This is a Test');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 'This is a Test');
$this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', 'This is a Test');
TestCakeSession::write('SessionTestCase', 'This was updated');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 'This was updated');
$this->assertEquals('This was updated', TestCakeSession::read('SessionTestCase'));
TestCakeSession::destroy();
$this->assertNull(TestCakeSession::read('SessionTestCase'));
@ -624,24 +624,24 @@ class CakeSessionTest extends CakeTestCase {
TestCakeSession::destroy();
TestCakeSession::write('SessionTestCase', 0);
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 0);
$this->assertEquals(0, TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', '0');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), '0');
$this->assertEquals('0', TestCakeSession::read('SessionTestCase'));
$this->assertFalse(TestCakeSession::read('SessionTestCase') === 0);
TestCakeSession::write('SessionTestCase', false);
$this->assertFalse(TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', null);
$this->assertEqual(TestCakeSession::read('SessionTestCase'), null);
$this->assertEquals(null, TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', 'This is a Test');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 'This is a Test');
$this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', 'This is a Test');
TestCakeSession::write('SessionTestCase', 'This was updated');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 'This was updated');
$this->assertEquals('This was updated', TestCakeSession::read('SessionTestCase'));
TestCakeSession::destroy();
$this->assertNull(TestCakeSession::read('SessionTestCase'));
@ -687,23 +687,23 @@ class CakeSessionTest extends CakeTestCase {
TestCakeSession::start();
TestCakeSession::write('SessionTestCase', 0);
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 0);
$this->assertEquals(0, TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', '0');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), '0');
$this->assertEquals('0', TestCakeSession::read('SessionTestCase'));
$this->assertFalse(TestCakeSession::read('SessionTestCase') === 0);
TestCakeSession::write('SessionTestCase', false);
$this->assertFalse(TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', null);
$this->assertEqual(TestCakeSession::read('SessionTestCase'), null);
$this->assertEquals(null, TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', 'This is a Test');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 'This is a Test');
$this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase'));
TestCakeSession::write('SessionTestCase', 'Some additional data');
$this->assertEqual(TestCakeSession::read('SessionTestCase'), 'Some additional data');
$this->assertEquals('Some additional data', TestCakeSession::read('SessionTestCase'));
TestCakeSession::destroy();
$this->assertNull(TestCakeSession::read('SessionTestCase'));
@ -729,21 +729,21 @@ class CakeSessionTest extends CakeTestCase {
TestCakeSession::destroy();
TestCakeSession::write('Test', 'some value');
$this->assertEqual(CakeSession::$sessionTime, time() + $timeoutSeconds);
$this->assertEqual($_SESSION['Config']['countdown'], 10);
$this->assertEqual($_SESSION['Config']['time'], CakeSession::$sessionTime);
$this->assertEqual(CakeSession::$time, time());
$this->assertEqual($_SESSION['Config']['time'], time() + $timeoutSeconds);
$this->assertEquals(time() + $timeoutSeconds, CakeSession::$sessionTime);
$this->assertEquals(10, $_SESSION['Config']['countdown']);
$this->assertEquals(CakeSession::$sessionTime, $_SESSION['Config']['time']);
$this->assertEquals(time(), CakeSession::$time);
$this->assertEquals(time() + $timeoutSeconds, $_SESSION['Config']['time']);
Configure::write('Session.harden', true);
TestCakeSession::destroy();
TestCakeSession::write('Test', 'some value');
$this->assertEqual(CakeSession::$sessionTime, time() + $timeoutSeconds);
$this->assertEqual($_SESSION['Config']['countdown'], 10);
$this->assertEqual($_SESSION['Config']['time'], CakeSession::$sessionTime);
$this->assertEqual(CakeSession::$time, time());
$this->assertEqual($_SESSION['Config']['time'], CakeSession::$time + $timeoutSeconds);
$this->assertEquals(time() + $timeoutSeconds, CakeSession::$sessionTime);
$this->assertEquals(10, $_SESSION['Config']['countdown']);
$this->assertEquals(CakeSession::$sessionTime, $_SESSION['Config']['time']);
$this->assertEquals(time(), CakeSession::$time);
$this->assertEquals(CakeSession::$time + $timeoutSeconds, $_SESSION['Config']['time']);
}
}