diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/MapTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/MapTest.php index cb97514a96e..d2c7556b682 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/MapTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/MapTest.php @@ -42,6 +42,8 @@ */ class MapTest extends \PHPUnit\Framework\TestCase { + use \VuFindTest\Feature\WithConsecutiveTrait; + /** * Get a Map object * @@ -183,9 +185,12 @@ public function testGetMapTabData(): void $recordDriver = $this->getMockBuilder(\VuFind\RecordDriver\SolrDefault::class) ->disableOriginalConstructor() ->getMock(); - $recordDriver->expects($this->exactly(2))->method('tryMethod') - ->withConsecutive(['getGeoLocation'], ['getDisplayCoordinates']) - ->willReturnOnConsecutiveCalls($coordinates, $displayCoord); + $this->expectConsecutiveCalls( + $recordDriver, + 'tryMethod', + [['getGeoLocation'], ['getDisplayCoordinates']], + [$coordinates, $displayCoord] + ); $obj->setRecordDriver($recordDriver); $expected = [[25.8,4.6,43.9,5.0,'','89 87 45 56']]; diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/TOCTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/TOCTest.php index b07aaa97233..8bb861bdb98 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/TOCTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordTab/TOCTest.php @@ -42,6 +42,8 @@ */ class TOCTest extends \PHPUnit\Framework\TestCase { + use \VuFindTest\Feature\WithConsecutiveTrait; + /** * Test getting Description. * @@ -79,9 +81,13 @@ public function testIsActive(string $toc, bool $expectedResult): void $recordDriver = $this->getMockBuilder(\VuFind\RecordDriver\SolrDefault::class) ->disableOriginalConstructor() ->getMock(); - $recordDriver->expects($this->any())->method('tryMethod') - ->withConsecutive([$this->equalTo('getTOC')], [$this->equalTo('getCleanISBN')]) - ->willReturnOnConsecutiveCalls($this->returnValue($toc), $this->returnValue('bar')); + $this->expectConsecutiveCalls( + $recordDriver, + 'tryMethod', + // We'll only do an ISBN lookup if the initial TOC is empty: + !empty($toc) ? [['getTOC']] : [['getTOC'], ['getCleanISBN']], + [$toc, 'bar'] + ); $obj = new TOC(); $obj->setRecordDriver($recordDriver); $this->assertSame($expectedResult, $obj->isActive());