Completed
Push — 8.7 ( b6d8c1...3ac046 )
by Markus
06:49
created

IdStoreTest::testSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DMK\MKSamlAuth\Tests\Unit\Store;
6
7
use DMK\MKSamlAuth\Store\IdStore;
8
use PHPUnit\Framework\TestCase;
9
use TYPO3\CMS\Core\Cache\CacheManager;
10
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
11
12
class IdStoreTest extends TestCase
13
{
14
    /**
15
     * @var IdStore
16
     */
17
    private $store;
18
    /**
19
     * @var \Prophecy\Prophecy\ObjectProphecy
20
     */
21
    private $cacheManager;
22
    /**
23
     * @var \Prophecy\Prophecy\ObjectProphecy
24
     */
25
    private $cache;
26
27
    protected function setUp()
28
    {
29
        $this->cache = $this->prophesize(FrontendInterface::class);
30
31
        $this->cacheManager = $this->prophesize(CacheManager::class);
32
        $this->cacheManager->getCache(IdStore::CACHE_KEY)->willReturn($this->cache->reveal());
33
34
        $this->store = new IdStore();
35
        $this->store->injectCacheManager($this->cacheManager->reveal());
36
    }
37
38
    public function testHas()
39
    {
40
        $this->cache->has('footest')->willReturn(false);
41
42
        self::assertFalse($this->store->has('foo', 'test'));
43
    }
44
45
    public function testSet()
46
    {
47
        $this->cache->set('footest', 'cdeb68b68f311608163d0d2f451ac96a', [], 300)
48
            ->shouldBeCalled();
49
50
        $this->store->set('foo', 'test', new \DateTime('+5 minutes'));
51
    }
52
}
53