1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * @copyright 2018 Mautic. All rights reserved |
||
7 | * @author Mautic |
||
8 | * |
||
9 | * @link https://mautic.org |
||
10 | * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html |
||
11 | */ |
||
12 | |||
13 | namespace Mautic\CacheBundle\Tests\EventListener; |
||
14 | |||
15 | use Mautic\CacheBundle\Cache\Adapter\FilesystemTagAwareAdapter; |
||
16 | use Mautic\CacheBundle\EventListener\CacheClearSubscriber; |
||
17 | use Monolog\Logger; |
||
18 | use PHPUnit\Framework\MockObject\MockObject; |
||
19 | |||
20 | class CacheClearSubscriberTest extends \PHPUnit\Framework\TestCase |
||
21 | { |
||
22 | /** |
||
23 | * @var MockObject|FilesystemTagAwareAdapter |
||
24 | */ |
||
25 | private $adapter; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $random; |
||
31 | |||
32 | public function setUp(): void |
||
33 | { |
||
34 | parent::setUp(); |
||
35 | $this->random = sha1((string) time()); |
||
36 | $this->adapter = $this->getMockBuilder(FilesystemTagAwareAdapter::class) |
||
0 ignored issues
–
show
|
|||
37 | ->disableOriginalConstructor() |
||
38 | ->setMethods(['clear', 'getCacheAdapter', 'commit']) |
||
39 | ->getMock(); |
||
40 | $this->adapter->method('clear')->willReturn($this->random); |
||
41 | $this->adapter->method('commit')->willReturn(null); |
||
42 | } |
||
43 | |||
44 | public function testClear(): void |
||
45 | { |
||
46 | $this->adapter->expects($this->once())->method('clear')->willReturn($this->random); |
||
47 | $subscriber = new CacheClearSubscriber($this->adapter, new Logger('test')); |
||
48 | $subscriber->clear('aaa'); |
||
49 | } |
||
50 | } |
||
51 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.