-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test to verify tags when used with deferred. (#65)
* Added test to verify tags when used with deferred. * allow skip * Require tag-interop
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
namespace Cache\IntegrationTests; | ||
|
||
use Cache\Adapter\Common\TaggableCacheItemPoolInterface; | ||
use Cache\TagInterop\TaggableCacheItemPoolInterface; | ||
|
||
/** | ||
* @author Tobias Nyholm <[email protected]> | ||
|
@@ -99,6 +99,25 @@ public function testPreviousTag() | |
$this->assertCount(1, $item->getPreviousTags()); | ||
} | ||
|
||
public function testPreviousTagDeferred() | ||
{ | ||
if (isset($this->skippedTests[__FUNCTION__])) { | ||
$this->markTestSkipped($this->skippedTests[__FUNCTION__]); | ||
|
||
return; | ||
} | ||
|
||
$item = $this->cache->getItem('key')->set('value'); | ||
$item->setTags(['tag0']); | ||
$this->assertCount(0, $item->getPreviousTags()); | ||
|
||
$this->cache->saveDeferred($item); | ||
$this->assertCount(0, $item->getPreviousTags()); | ||
|
||
$item = $this->cache->getItem('key'); | ||
$this->assertCount(1, $item->getPreviousTags()); | ||
} | ||
|
||
/** | ||
* @expectedException \Psr\Cache\InvalidArgumentException | ||
*/ | ||
|
@@ -260,6 +279,12 @@ public function testInvalidateTags() | |
*/ | ||
public function testTagsAreCleanedOnSave() | ||
{ | ||
if (isset($this->skippedTests[__FUNCTION__])) { | ||
$this->markTestSkipped($this->skippedTests[__FUNCTION__]); | ||
|
||
return; | ||
} | ||
|
||
$pool = $this->cache; | ||
$i = $pool->getItem('key')->set('value'); | ||
$pool->save($i->setTags(['foo'])); | ||
|