Skip to content

Commit

Permalink
fix: MapperTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Nattfarinn committed Apr 16, 2024
1 parent 189e046 commit fe1bbdc
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions eZ/Publish/Core/Persistence/Legacy/Tests/Content/MapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/
namespace eZ\Publish\Core\Persistence\Legacy\Tests\Content;

use eZ\Publish\Core\Persistence\Legacy\Content\Gateway;
use eZ\Publish\Core\Persistence\Legacy\Content\StorageRegistry;
use Ibexa\Core\Persistence\Legacy\Content\Mapper\ResolveVirtualFieldSubscriber;
use function count;
use eZ\Publish\API\Repository\Values\Content\Relation as RelationValue;
use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter;
Expand Down Expand Up @@ -227,7 +230,7 @@ public function testExtractContentFromRowsWithNewFieldDefinitions(): void
'ezdatetime',
'ezkeyword',
'eznumber',
], count($rowsFixture));
], count($rowsFixture) - 1);

$mapper = new Mapper(
$reg,
Expand All @@ -242,6 +245,7 @@ public function testExtractContentFromRowsWithNewFieldDefinitions(): void
'type' => 'eznumber',
'languageCode' => 'eng-US',
'value' => new FieldValue(),
'versionNo' => 2,
]);

$this->assertEquals(
Expand Down Expand Up @@ -682,6 +686,10 @@ protected function getValueConverterRegistryMock()
$this->valueConverterRegistryMock = $this->getMockBuilder(Registry::class)
->setMethods([])
->getMock();

$this->valueConverterRegistryMock
->method('getConverter')
->willReturn($this->createMock(Converter::class));
}

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

protected function getEventDispatcher(): EventDispatcherInterface
{
return new EventDispatcher();
$eventDispatcher = new EventDispatcher();
$eventDispatcher->addSubscriber(
new ResolveVirtualFieldSubscriber(
$this->getValueConverterRegistryMock(),
new StorageRegistry([]),
$this->createMock(Gateway::class)
)
);

return $eventDispatcher;
}

/**
Expand Down

0 comments on commit fe1bbdc

Please sign in to comment.