Example #1
0
 /**
  * Tests if cache is used on getItem().
  *
  * @return void
  */
 public function testCacheOnGetItem()
 {
     $this->if($cache = $this->createCacheMock())->and($awsClient = $this->createAwsClientMock())->and($awsClient->getMockController()->getItem = null)->and($client = new Base($awsClient))->and($client->setCache($cache))->and($client->getItem($tableName = uniqid(), ['id' => ['N' => $id = uniqid()], 'parent' => ['S' => $parent = uniqid()]]))->then->mock($cache)->call('has')->once()->call('set')->once()->call('get')->never()->if($cache->getMockController()->resetCalls())->and($client->getItem($tableName, ['parent' => ['S' => $parent], 'id' => ['N' => $id]]))->then->mock($cache)->call('has')->once()->call('set')->never()->call('get')->once();
 }