diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index 682dd83..72cebef 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -73,7 +73,7 @@ public function it_can_call_client_query() $client = m::mock(DynamoDbClient::class); $client->shouldReceive('query')->with([ 'TableName' => 'User' - ]); + ])->once(); $connection = new Connection([]); $connection->setClient($client); @@ -88,7 +88,7 @@ public function it_can_forward_call_to_dynamodb_client() $client = m::mock(DynamoDbClient::class); $client->shouldReceive('getItem')->with([ 'TableName' => 'User' - ]); + ])->once(); $connection = new Connection([]); $connection->setClient($client); diff --git a/tests/Model/ModelTest.php b/tests/Model/ModelTest.php index a872613..7660bb8 100644 --- a/tests/Model/ModelTest.php +++ b/tests/Model/ModelTest.php @@ -400,7 +400,7 @@ public function it_can_process_all() ]); $connection = $this->newConnectionMock(); - $connection->shouldReceive('scan')->with($params)->andReturn($return); + $connection->shouldReceive('scan')->with($params)->andReturn($return)->once(); $this->setConnectionResolver($connection); UserA::all(); @@ -423,7 +423,7 @@ public function it_can_save_new_instance() ]; $connection = $this->newConnectionMock(); - $connection->shouldReceive('putItem')->with($params); + $connection->shouldReceive('putItem')->with($params)->once(); $this->setConnectionResolver($connection); $user = new UserA(['partition' => 'p']); @@ -448,7 +448,7 @@ public function it_can_static_create_new_instance() ]; $connection = $this->newConnectionMock(); - $connection->shouldReceive('putItem')->with($params); + $connection->shouldReceive('putItem')->with($params)->once(); $this->setConnectionResolver($connection); UserD::create(['partition' => 'p']); @@ -490,7 +490,7 @@ public function it_can_save_existing_instance() ]; $connection = $this->newConnectionMock(); - $connection->shouldReceive('updateItem')->with($params)->andReturn($this->sampleAwsResultEmpty()); + $connection->shouldReceive('updateItem')->with($params)->andReturn($this->sampleAwsResultEmpty())->once(); $this->setConnectionResolver($connection); $user = (new UserA)->newFromBuilder(['partition' => 'p']); @@ -526,7 +526,7 @@ public function it_can_delete_existing_instance() ]; $connection = $this->newConnectionMock(); - $connection->shouldReceive('deleteItem')->with($params); + $connection->shouldReceive('deleteItem')->with($params)->once(); $this->setConnectionResolver($connection); $user = (new UserA)->newFromBuilder(['partition' => 'p']); @@ -575,7 +575,7 @@ public function it_can_call_allowed_builder_method() 'S' => 'p' ] ] - ]); + ])->once(); $this->setConnectionResolver($connection); UserA::putItem([ diff --git a/tests/Query/BuilderTest.php b/tests/Query/BuilderTest.php index ac63850..b67ed13 100644 --- a/tests/Query/BuilderTest.php +++ b/tests/Query/BuilderTest.php @@ -952,7 +952,8 @@ public function it_can_process_process() $connection = m::mock(Connection::class); $connection->shouldReceive('scan') ->with(['TableName' => 'Forum']) - ->andReturn(new Result(['Items' => []])); + ->andReturn(new Result(['Items' => []])) + ->once(); $query = new Builder($connection, new Grammar, new Processor); @@ -974,7 +975,7 @@ public function it_can_process_process_with_no_processor() 'S' => 'Laravel Thread 1' ] ] - ])->andReturn(new Result(['Items' => []])); + ])->andReturn(new Result(['Items' => []]))->once(); $query = new Builder($connection, new Grammar, new Processor);