-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathTotalCountCacheTest.php
More file actions
47 lines (36 loc) · 1.1 KB
/
TotalCountCacheTest.php
File metadata and controls
47 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
declare(strict_types=1);
namespace Overblog\GraphQLBundle\Tests\Relay\Connection;
use Overblog\GraphQLBundle\Relay\Connection\TotalCountCache;
use PHPUnit\Framework\TestCase;
class TotalCountCacheTest extends TestCase
{
public function testCacheCallable(): void
{
$total = $this->createMock(TotalCountCache::class);
$total
->expects($this->once())
->method('__invoke')
->willReturn(7);
$cache = new TotalCountCache($total);
$this->assertEquals(7, $cache());
$this->assertEquals(7, $cache());
}
public function testCacheInt(): void
{
$cache = new TotalCountCache(12);
$this->assertEquals(12, $cache());
}
public function testReset(): void
{
$total = $this->createMock(TotalCountCache::class);
$total
->expects($this->exactly(2))
->method('__invoke')
->willReturn(7);
$cache = new TotalCountCache($total);
$this->assertEquals(7, $cache());
$cache->reset();
$this->assertEquals(7, $cache());
}
}