Skip to content

Commit

Permalink
Merge pull request #22 from Nyholm/no-data
Browse files Browse the repository at this point in the history
Test save and fetch item with no data
  • Loading branch information
Nyholm committed Jan 11, 2016
2 parents bf1e5bb + d8e0cb4 commit f5bed9b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/CachePoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,22 @@ public function testSave()
$this->assertEquals('value', $this->cache->getItem('key')->get());
}

public function testSaveWithNoData()
{
if (isset($this->skippedTests[__FUNCTION__])) {
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);

return;
}

$item = $this->cache->getItem('key');
$return = $this->cache->save($item);

$this->assertFalse($return, 'When saving an object with no data, we should generate an error.');
$this->assertFalse($this->cache->hasItem('key'), 'A saved item with no data should not be a hit.');
$this->assertFalse($this->cache->getItem('key')->isHit(), 'A saved item with no data should not be a hit.');
}

public function testDeferredSave()
{
if (isset($this->skippedTests[__FUNCTION__])) {
Expand Down

0 comments on commit f5bed9b

Please sign in to comment.