1 | <?php |
||
30 | abstract class AbstractBaseHandlerTest extends TestCase |
||
31 | { |
||
32 | /** |
||
33 | * @var \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface|\PHPUnit_Framework_MockObject_MockObject |
||
34 | */ |
||
35 | protected $cacheMock; |
||
36 | |||
37 | /** |
||
38 | * @var \eZ\Publish\SPI\Persistence\Handler|\PHPUnit_Framework_MockObject_MockObject |
||
39 | */ |
||
40 | protected $persistenceHandlerMock; |
||
41 | |||
42 | /** |
||
43 | * @var \eZ\Publish\Core\Persistence\Cache\Handler |
||
44 | */ |
||
45 | protected $persistenceCacheHandler; |
||
46 | |||
47 | /** |
||
48 | * @var \eZ\Publish\Core\Persistence\Cache\PersistenceLogger|\PHPUnit_Framework_MockObject_MockObject |
||
49 | */ |
||
50 | protected $loggerMock; |
||
51 | |||
52 | /** |
||
53 | * @var \Closure |
||
54 | */ |
||
55 | protected $cacheItemsClosure; |
||
56 | |||
57 | /** |
||
58 | * Setup the HandlerTest. |
||
59 | */ |
||
60 | final protected function setUp() |
||
61 | { |
||
62 | parent::setUp(); |
||
63 | |||
64 | $this->persistenceHandlerMock = $this->createMock(Handler::class); |
||
65 | $this->cacheMock = $this->createMock(TagAwareAdapterInterface::class); |
||
66 | $this->loggerMock = $this->createMock(PersistenceLogger::class); |
||
67 | |||
68 | $this->persistenceCacheHandler = new CacheHandler( |
||
69 | $this->persistenceHandlerMock, |
||
70 | new CacheSectionHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
71 | new CacheLocationHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
72 | new CacheContentHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
73 | new CacheContentLanguageHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
74 | new CacheContentTypeHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
75 | new CacheUserHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
76 | new CacheTransactionHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
77 | new CacheTrashHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
78 | new CacheUrlAliasHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
79 | new CacheObjectStateHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
80 | new CacheUrlHandler($this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock), |
||
81 | $this->loggerMock, |
||
82 | $this->cacheMock |
||
83 | ); |
||
84 | |||
85 | $this->cacheItemsClosure = \Closure::bind( |
||
86 | function ($key, $value, $isHit, $defaultLifetime = 0) { |
||
87 | $item = new CacheItem(); |
||
88 | $item->key = $key; |
||
|
|||
89 | $item->value = $value; |
||
90 | $item->isHit = $isHit; |
||
91 | $item->defaultLifetime = $defaultLifetime; |
||
92 | |||
93 | return $item; |
||
94 | }, |
||
95 | null, |
||
96 | CacheItem::class |
||
97 | ); |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * Tear down test (properties). |
||
102 | */ |
||
103 | final protected function tearDown() |
||
112 | |||
113 | /** |
||
114 | * @param $key |
||
115 | * @param null $value If null the cache item will be assumed to be a cache miss here. |
||
116 | * @param int $defaultLifetime |
||
117 | * |
||
118 | * @return CacheItem |
||
119 | */ |
||
120 | final protected function getCacheItem($key, $value = null, $defaultLifetime = 0) |
||
126 | } |
||
127 |
This check looks for access to properties that are not accessible from the current context.
If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.