| @@ 99-113 (lines=15) @@ | ||
| 96 | /** |
|
| 97 | * Test that CacheStorageInterface::has() is called and returns true on finding key |
|
| 98 | */ |
|
| 99 | public function testHasFoundWithKey() |
|
| 100 | { |
|
| 101 | $key = 'key'; |
|
| 102 | $expected = true; |
|
| 103 | ||
| 104 | $this->storageMock->expects($this->once()) |
|
| 105 | ->method('has') |
|
| 106 | ->with( |
|
| 107 | $this->equalTo($key) |
|
| 108 | ) |
|
| 109 | ->willReturn($expected); |
|
| 110 | ||
| 111 | $actual = $this->cache->has($key); |
|
| 112 | $this->assertEquals($expected, $actual); |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * Test that CacheStorageInterface::has() is called and returns false on failing to find key |
|
| @@ 118-132 (lines=15) @@ | ||
| 115 | /** |
|
| 116 | * Test that CacheStorageInterface::has() is called and returns false on failing to find key |
|
| 117 | */ |
|
| 118 | public function testHasFoundNoKey() |
|
| 119 | { |
|
| 120 | $key = 'key'; |
|
| 121 | $expected = false; |
|
| 122 | ||
| 123 | $this->storageMock->expects($this->once()) |
|
| 124 | ->method('has') |
|
| 125 | ->with( |
|
| 126 | $this->equalTo($key) |
|
| 127 | ) |
|
| 128 | ->willReturn($expected); |
|
| 129 | ||
| 130 | $actual = $this->cache->has($key); |
|
| 131 | $this->assertEquals($expected, $actual); |
|
| 132 | } |
|
| 133 | ||
| 134 | ||
| 135 | /** |
|
| @@ 90-105 (lines=16) @@ | ||
| 87 | [false] |
|
| 88 | ); |
|
| 89 | } |
|
| 90 | public function testSet() |
|
| 91 | { |
|
| 92 | $key = 'key'; |
|
| 93 | $value = 'value'; |
|
| 94 | $expires = 10; |
|
| 95 | $this->memcacheMock->expects($this->once()) |
|
| 96 | ->method('set') |
|
| 97 | ->with( |
|
| 98 | $this->equalTo($key), |
|
| 99 | $this->equalTo($value), |
|
| 100 | $this->equalTo($expires) |
|
| 101 | ); |
|
| 102 | $this->memcacheStorage->set($key, $value, $expires); |
|
| 103 | } |
|
| 104 | public function testGet() |
|
| 105 | { |
|
| 106 | $key = 'key'; |
|
| 107 | $this->memcacheMock->expects($this->once()) |
|
| 108 | ->method('get') |
|