Skip to content

Commit

Permalink
Remove calls to TestCase::at (#35474)
Browse files Browse the repository at this point in the history
  • Loading branch information
soilSpoon committed Dec 4, 2020
1 parent 6c5c6b2 commit 4822b4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions tests/Database/DatabaseConnectionTest.php
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
8 changes: 4 additions & 4 deletions tests/Validation/ValidationValidatorTest.php
Expand Up @@ -1787,14 +1787,14 @@ 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);
$file->method('isValid')->willReturn(true);
$file->method('getSize')->willReturn(3072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:10']);
$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);
$file->method('isValid')->willReturn(true);
$file->method('getSize')->willReturn(4072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:2']);
$this->assertFalse($v->passes());

Expand Down

0 comments on commit 4822b4f

Please sign in to comment.