Skip to content

Commit

Permalink
Added unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
martinssipenko committed Sep 13, 2015
1 parent 166e5f6 commit e605515
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/S3/BatchDeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,24 @@ public function testDeletesYieldedCommadnsWhenEachCallbackReturns()
$keys = \JmesPath\search('[].Delete.Objects[].Key', $cmds);
$this->assertEquals(range(0, 9), $keys);
}

public function testWithNoMatchingObjects()
{
$client = $this->getTestClient('s3');
$mock = new MockHandler([
new Result([
'IsTruncated' => false,
'Contents' => null
]),
new Result([])
]);
$client->getHandlerList()->setHandler($mock);
$params = ['Bucket' => 'foo'];
$batch = BatchDelete::fromListObjects($client, $params);
$batch->delete();
$last = $mock->getLastCommand();
$this->assertEquals('ListObjects', $last->getName());
$this->assertEquals(0, count($last['Delete']['Objects']));
$this->assertEquals('foo', $last['Bucket']);
}
}

0 comments on commit e605515

Please sign in to comment.