Skip to content

Commit

Permalink
Test offsetUnset
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed May 14, 2018
1 parent 2ffd3c1 commit 1720c6b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/unit/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,29 @@ public function testDelete(array $keyValuePairs):void {
}
}

/**
* @dataProvider data_randomKeyValuePairs
*/
public function testOffsetUnset(array $keyValuePairs):void {
$handler = $this->getMockBuilder(Handler::class)
->getMock();
$session = new Session($handler);

foreach($keyValuePairs as $key => $value) {
$session->set($key, $value);
}

uasort($keyValuePairs, function () {
return rand(-1, 1);
});

foreach($keyValuePairs as $key => $value) {
self::assertTrue($session->has($key));
unset($session[$key]);
self::assertFalse($session->has($key));
}
}

public function testWriteSessionDataCalled() {
$handler = $this->getMockBuilder(Handler::class)
->getMock();
Expand Down

0 comments on commit 1720c6b

Please sign in to comment.