mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixes tests to expect changes made to read and write methods - This could be a possible BC change
Since php 7 expects write to return true or false this needed to change, previous implementation would return the values sent to write on success and false on failure. Similar change to read method test CakeSession::read() now returns results or ''.
This commit is contained in:
parent
3c21f4a8af
commit
1fd329311b
1 changed files with 7 additions and 22 deletions
|
@ -122,19 +122,8 @@ class DatabaseSessionTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testWrite() {
|
||||
$result = $this->storage->write('foo', 'Some value');
|
||||
$expected = array(
|
||||
'Session' => array(
|
||||
'id' => 'foo',
|
||||
'data' => 'Some value',
|
||||
)
|
||||
);
|
||||
$expires = $result['Session']['expires'];
|
||||
unset($result['Session']['expires']);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$expected = time() + (Configure::read('Session.timeout') * 60);
|
||||
$this->assertWithinMargin($expires, $expected, 1);
|
||||
$this->storage->write('foo', 'Some value');
|
||||
$this->assertEquals($this->storage->read('foo'), 'Some value');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,13 +143,8 @@ class DatabaseSessionTest extends CakeTestCase {
|
|||
*/
|
||||
public function testRead() {
|
||||
$this->storage->write('foo', 'Some value');
|
||||
|
||||
$result = $this->storage->read('foo');
|
||||
$expected = 'Some value';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->storage->read('made up value');
|
||||
$this->assertFalse($result);
|
||||
$this->assertEquals($this->storage->read('foo'), 'Some value');
|
||||
$this->assertSame('', $this->storage->read('made up value'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +156,8 @@ class DatabaseSessionTest extends CakeTestCase {
|
|||
$this->storage->write('foo', 'Some value');
|
||||
|
||||
$this->assertTrue($this->storage->destroy('foo'), 'Destroy failed');
|
||||
$this->assertFalse($this->storage->read('foo'), 'Value still present.');
|
||||
$this->assertSame($this->storage->read('foo'), '');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,7 +174,7 @@ class DatabaseSessionTest extends CakeTestCase {
|
|||
|
||||
sleep(1);
|
||||
$storage->gc();
|
||||
$this->assertFalse($storage->read('foo'));
|
||||
$this->assertSame($storage->read('foo'), '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue