Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97d3b01

Browse files
authored
[#137] Fix not using the adapter's cache item
2 parents 1072341 + 268447c commit 97d3b01

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
parameter. #135
1515
- A custom field class is loaded in objects even if the response data does not
1616
contain any fields in that namespace. #135
17+
- Fix not using the adapter's cache item #137
1718

1819
## [0.5.0] - 2018-06-21
1920

src/Service/AccessManagement/ResolveDomain.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Lullabot\Mpx\Service\AccessManagement;
44

5-
use Cache\Adapter\Common\CacheItem;
65
use Lullabot\Mpx\DataService\IdInterface;
76
use Lullabot\Mpx\Normalizer\UriNormalizer;
87
use Symfony\Component\Serializer\Encoder\JsonEncoder;
@@ -58,7 +57,6 @@ public function resolve(IdInterface $account): ResolveDomainResponse
5857
$serializer = new Serializer($normalizers, $encoders);
5958

6059
$resolved = $serializer->deserialize($response->getBody(), ResolveDomainResponse::class, 'json');
61-
$item = new CacheItem($key);
6260
$item->set($resolved);
6361

6462
// thePlatform provides no guidance on how long we can cache this for.

tests/src/Unit/Service/AccessManagement/ResolveDomainTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ public function testResolveCache()
8888

8989
$cache->expects($this->once())->method('save');
9090

91-
$item->expects($this->at(0))->method('isHit')
92-
->willReturn(false);
93-
$item->expects($this->at(1))->method('isHit')
94-
->willReturn(true);
91+
$item->expects($this->exactly(2))->method('isHit')
92+
->willReturnOnConsecutiveCalls(false, true);
93+
$item->expects($this->at(0))->method('set');
9594

9695
$resolveDomain = new ResolveDomain($authenticatedClient, $cache);
9796

0 commit comments

Comments
 (0)