Skip to content

Commit

Permalink
Remove calls to onConsecutiveCalls()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Apr 30, 2024
1 parent 62cec4a commit 247e98d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions Tests/Loader/FileLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ public function testImportWithFileLocatorDelegation()
$locatorMock = $this->createMock(FileLocatorInterface::class);

$locatorMockForAdditionalLoader = $this->createMock(FileLocatorInterface::class);
$locatorMockForAdditionalLoader->expects($this->any())->method('locate')->will($this->onConsecutiveCalls(
['path/to/file1'], // Default
['path/to/file1', 'path/to/file2'], // First is imported
['path/to/file1', 'path/to/file2'], // Second is imported
['path/to/file1'], // Exception
['path/to/file1', 'path/to/file2'] // Exception
));
$locatorMockForAdditionalLoader->expects($this->any())
->method('locate')
->willReturn(
['path/to/file1'],
['path/to/file1', 'path/to/file2'],
['path/to/file1', 'path/to/file2'],
['path/to/file1'],
['path/to/file1', 'path/to/file2']
);

$fileLoader = new TestFileLoader($locatorMock);
$fileLoader->setSupports(false);
Expand Down
3 changes: 2 additions & 1 deletion Tests/Util/XmlUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public function testLoadFile()
}

$mock = $this->createMock(Validator::class);
$mock->expects($this->exactly(2))->method('validate')->will($this->onConsecutiveCalls(false, true));
$mock->expects($this->exactly(2))->method('validate')
->willReturn(false, true);

try {
XmlUtils::loadFile($fixtures.'valid.xml', [$mock, 'validate']);
Expand Down

0 comments on commit 247e98d

Please sign in to comment.