Skip to content

Commit bf45f11

Browse files
committed
[8.x ]Refactor setMethods to onlyMethods and addMethods
`MockBuilder::setMethods` is soft deprecated as of PHPUnit 9 So I refactor the test. Please merge laravel#35474 after merging sebastianbergmann/phpunit#3687
1 parent b89363b commit bf45f11

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/Database/DatabaseConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function testSelectProperlyCallsPDO()
6262
$writePdo = $this->getMockBuilder(DatabaseConnectionTestMockPDO::class)->onlyMethods(['prepare'])->getMock();
6363
$writePdo->expects($this->never())->method('prepare');
6464
$statement = $this->getMockBuilder('PDOStatement')
65-
->setMethods(['setFetchMode', 'execute', 'fetchAll', 'bindValue'])
65+
->onlyMethods(['setFetchMode', 'execute', 'fetchAll', 'bindValue'])
6666
->getMock();
6767
$statement->expects($this->once())->method('setFetchMode');
6868
$statement->expects($this->once())->method('bindValue')->with('foo', 'bar', 2);

tests/Validation/ValidationValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,7 @@ public function testValidateImage()
28722872
$v = new Validator($trans, ['x' => $file7], ['x' => 'Image']);
28732873
$this->assertTrue($v->passes());
28742874

2875-
$file2 = $this->getMockBuilder(UploadedFile::class)->setMethods(['guessExtension', 'getClientOriginalExtension'])->setConstructorArgs($uploadedFile)->getMock();
2875+
$file2 = $this->getMockBuilder(UploadedFile::class)->onlyMethods(['guessExtension', 'getClientOriginalExtension'])->setConstructorArgs($uploadedFile)->getMock();
28762876
$file2->expects($this->any())->method('guessExtension')->willReturn('jpg');
28772877
$file2->expects($this->any())->method('getClientOriginalExtension')->willReturn('jpg');
28782878
$v = new Validator($trans, ['x' => $file2], ['x' => 'Image']);

0 commit comments

Comments
 (0)