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