Skip to content

Commit

Permalink
Remove calls to TestCase::at
Browse files Browse the repository at this point in the history
  • Loading branch information
soilSpoon committed Dec 3, 2020
1 parent 6c5c6b2 commit 34b0de4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions tests/Database/DatabaseConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@ public function testTransactionLevelNotIncrementedOnTransactionException()
public function testBeginTransactionMethodRetriesOnFailure()
{
$pdo = $this->createMock(DatabaseConnectionTestMockPDO::class);
$pdo->expects($this->at(0))
->method('beginTransaction')
->will($this->throwException(new ErrorException('server has gone away')));
$pdo->method('beginTransaction')
->willReturnOnConsecutiveCalls($this->throwException(new ErrorException('server has gone away')));
$connection = $this->getMockConnection(['reconnect'], $pdo);
$connection->expects($this->once())->method('reconnect');
$connection->beginTransaction();
Expand Down
12 changes: 5 additions & 7 deletions tests/Validation/ValidationValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1787,15 +1787,13 @@ public function testValidateMax()
$this->assertFalse($v->passes());

$file = $this->getMockBuilder(UploadedFile::class)->setMethods(['isValid', 'getSize'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
$file->expects($this->any())->method('isValid')->willReturn(true);
$file->expects($this->at(1))->method('getSize')->willReturn(3072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:10']);
$file->method('isValid')->willReturn(true);
$file->method('getSize')->willReturn(4096);

$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:4']);
$this->assertTrue($v->passes());

$file = $this->getMockBuilder(UploadedFile::class)->setMethods(['isValid', 'getSize'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
$file->expects($this->at(0))->method('isValid')->willReturn(true);
$file->expects($this->at(1))->method('getSize')->willReturn(4072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:2']);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:3']);
$this->assertFalse($v->passes());

$file = $this->getMockBuilder(UploadedFile::class)->setMethods(['isValid'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
Expand Down

0 comments on commit 34b0de4

Please sign in to comment.