Skip to content

Commit fe1bbdc

Browse files
committed
fix: MapperTest
1 parent 189e046 commit fe1bbdc

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

eZ/Publish/Core/Persistence/Legacy/Tests/Content/MapperTest.php

+19-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
*/
77
namespace eZ\Publish\Core\Persistence\Legacy\Tests\Content;
88

9+
use eZ\Publish\Core\Persistence\Legacy\Content\Gateway;
10+
use eZ\Publish\Core\Persistence\Legacy\Content\StorageRegistry;
11+
use Ibexa\Core\Persistence\Legacy\Content\Mapper\ResolveVirtualFieldSubscriber;
912
use function count;
1013
use eZ\Publish\API\Repository\Values\Content\Relation as RelationValue;
1114
use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter;
@@ -227,7 +230,7 @@ public function testExtractContentFromRowsWithNewFieldDefinitions(): void
227230
'ezdatetime',
228231
'ezkeyword',
229232
'eznumber',
230-
], count($rowsFixture));
233+
], count($rowsFixture) - 1);
231234

232235
$mapper = new Mapper(
233236
$reg,
@@ -242,6 +245,7 @@ public function testExtractContentFromRowsWithNewFieldDefinitions(): void
242245
'type' => 'eznumber',
243246
'languageCode' => 'eng-US',
244247
'value' => new FieldValue(),
248+
'versionNo' => 2,
245249
]);
246250

247251
$this->assertEquals(
@@ -682,6 +686,10 @@ protected function getValueConverterRegistryMock()
682686
$this->valueConverterRegistryMock = $this->getMockBuilder(Registry::class)
683687
->setMethods([])
684688
->getMock();
689+
690+
$this->valueConverterRegistryMock
691+
->method('getConverter')
692+
->willReturn($this->createMock(Converter::class));
685693
}
686694

687695
return $this->valueConverterRegistryMock;
@@ -707,7 +715,16 @@ protected function getRelationCreateStructFixture()
707715

708716
protected function getEventDispatcher(): EventDispatcherInterface
709717
{
710-
return new EventDispatcher();
718+
$eventDispatcher = new EventDispatcher();
719+
$eventDispatcher->addSubscriber(
720+
new ResolveVirtualFieldSubscriber(
721+
$this->getValueConverterRegistryMock(),
722+
new StorageRegistry([]),
723+
$this->createMock(Gateway::class)
724+
)
725+
);
726+
727+
return $eventDispatcher;
711728
}
712729

713730
/**

0 commit comments

Comments
 (0)