From cbdedf76c60086b5535a65aba13e66184fa343d9 Mon Sep 17 00:00:00 2001 From: Robert Lange Date: Thu, 18 Apr 2024 18:39:20 +0200 Subject: [PATCH] refs #2999 adjust test fir getCheckbox: use separate property for new html id --- .../View/Helper/Root/RecordTest.php | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordTest.php index 53653c65238..e92949515e4 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/View/Helper/Root/RecordTest.php @@ -388,18 +388,26 @@ public function consecutiveCalls(...$args): callable public function testGetCheckbox() { $context = $this->getMockContext(); - $context->expects($this->exactly(2))->method('renderInContext') - ->with( - self::callback(self::consecutiveCalls( - 'record/checkbox.phtml', - ['id' => 'bar-Solr|000105196', 'number' => 1, 'prefix' => 'bar', 'formAttr' => 'foo'] - )), - self::callback(self::consecutiveCalls( - 'record/checkbox.phtml', - ['id' => 'bar-Solr|000105196', 'number' => 2, 'prefix' => 'bar', 'formAttr' => 'foo'] - )) + $context->expects($this->exactly(2)) + ->method('renderInContext') + ->withConsecutive( + ['record/checkbox.phtml', $this->callback(function ($array) { + return ($array['number'] ?? null) == 1 && + ($array['id'] ?? '') == 'Solr|000105196' && + ($array['checkboxElementId'] ?? '') == 'bar-Solr|000105196' && + ($array['prefix'] ?? '') == 'bar' && + ($array['formAttr'] ?? '') == 'foo'; + })], + ['record/checkbox.phtml', $this->callback(function ($array) { + return ($array['number'] ?? null) == 2 && + ($array['id'] ?? '') == 'Solr|000105196' && + ($array['checkboxElementId'] ?? '') == 'bar-Solr|000105196' && + ($array['prefix'] ?? '') == 'bar' && + ($array['formAttr'] ?? '') == 'foo'; + })] ) ->willReturnOnConsecutiveCalls('success', 'success'); + $record = $this->getRecord( $this->loadRecordFixture('testbug1.json'), [],