Skip to content

Commit 7ed3078

Browse files
jonasraoniasmecher
authored andcommittedNov 17, 2023
pkp/pkp-lib#8915 Fixed unit test
1 parent ad9b8f8 commit 7ed3078

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed
 

‎tests/classes/search/ArticleSearchIndexTest.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
use Mockery;
2828
use Mockery\MockInterface;
2929
use PHPUnit\Framework\MockObject\MockObject;
30-
use PKP\core\ArrayItemIterator;
3130
use PKP\db\DAORegistry;
31+
use PKP\db\DAOResultFactory;
3232
use PKP\plugins\Hook;
3333
use PKP\submissionFile\Collector as SubmissionFileCollector;
3434
use PKP\submissionFile\SubmissionFile;
@@ -411,10 +411,15 @@ private function registerMockJournalDAO()
411411
->getMock();
412412

413413
// Mock an empty result set.
414-
$journals = [];
415-
$journalsIterator = new ArrayItemIterator($journals);
414+
$journalsIterator = $this->getMockBuilder(DAOResultFactory::class)
415+
->disableOriginalConstructor()
416+
->onlyMethods(['toIterator'])
417+
->getMock();
418+
$journalsIterator
419+
->method('toIterator')
420+
->will($this->returnValue([]));
416421

417-
// Mock the getById() method.
422+
// Mock the getAll() method.
418423
$journalDao->expects($this->any())
419424
->method('getAll')
420425
->will($this->returnValue($journalsIterator));

0 commit comments

Comments
 (0)
Please sign in to comment.