-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/6.3' into 7.0
- Loading branch information
Showing
4 changed files
with
104 additions
and
5 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
48 changes: 48 additions & 0 deletions
48
Neos.Cache/Tests/Unit/Backend/TaggableMultiBackendTest.php
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Neos\Cache\Tests\Unit\Backend; | ||
|
||
include_once(__DIR__ . '/../../BaseTestCase.php'); | ||
|
||
use Neos\Cache\Backend\NullBackend; | ||
use Neos\Cache\Backend\TaggableMultiBackend; | ||
use Neos\Cache\EnvironmentConfiguration; | ||
use Neos\Cache\Tests\BaseTestCase; | ||
|
||
class TaggableMultiBackendTest extends BaseTestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function flushByTagReturnsCountOfFlushedEntries(): void | ||
{ | ||
$mockBuilder = $this->getMockBuilder(NullBackend::class); | ||
$firstNullBackendMock = $mockBuilder->getMock(); | ||
$secondNullBackendMock = $mockBuilder->getMock(); | ||
$thirdNullBackendMock = $mockBuilder->getMock(); | ||
|
||
$firstNullBackendMock->expects(self::once())->method('flushByTag')->with('foo')->willReturn(2); | ||
$secondNullBackendMock->expects(self::once())->method('flushByTag')->with('foo')->willThrowException(new \RuntimeException()); | ||
$thirdNullBackendMock->expects(self::once())->method('flushByTag')->with('foo')->willReturn(3); | ||
|
||
$multiBackend = new TaggableMultiBackend($this->getEnvironmentConfiguration(), []); | ||
$this->inject($multiBackend, 'backends', [$firstNullBackendMock, $secondNullBackendMock, $thirdNullBackendMock]); | ||
$this->inject($multiBackend, 'initialized', true); | ||
|
||
$result = $multiBackend->flushByTag('foo'); | ||
self::assertSame(5, $result); | ||
} | ||
|
||
/** | ||
* @return EnvironmentConfiguration | ||
*/ | ||
public function getEnvironmentConfiguration(): EnvironmentConfiguration | ||
{ | ||
return new EnvironmentConfiguration( | ||
__DIR__ . '~Testing', | ||
'vfs://Foo/', | ||
255 | ||
); | ||
} | ||
} |
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