Skip to content

Commit

Permalink
fix risky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kitar committed Dec 12, 2022
1 parent 401f3b1 commit e814bda
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions tests/Model/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand 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']);
Expand All @@ -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']);
Expand Down Expand Up @@ -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']);
Expand Down Expand Up @@ -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']);
Expand Down Expand Up @@ -575,7 +575,7 @@ public function it_can_call_allowed_builder_method()
'S' => 'p'
]
]
]);
])->once();
$this->setConnectionResolver($connection);

UserA::putItem([
Expand Down
5 changes: 3 additions & 2 deletions tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit e814bda

Please sign in to comment.