From 07d6721b8e006bb3bfbd265a9ff86c3f9ace3280 Mon Sep 17 00:00:00 2001 From: Nattfarinn Date: Thu, 25 Apr 2024 09:48:00 +0200 Subject: [PATCH] fix: Code Review --- .../Persistence/Legacy/Content/Mapper.php | 4 +-- .../FieldType/DefaultDataFieldStorage.php | 9 ++++--- .../ResolveVirtualFieldSubscriberTest.php | 27 +++++++------------ 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/eZ/Publish/Core/Persistence/Legacy/Content/Mapper.php b/eZ/Publish/Core/Persistence/Legacy/Content/Mapper.php index e1880eb79a..dafce22757 100644 --- a/eZ/Publish/Core/Persistence/Legacy/Content/Mapper.php +++ b/eZ/Publish/Core/Persistence/Legacy/Content/Mapper.php @@ -217,8 +217,8 @@ public function convertToStorageValue(Field $field) * * "$tableName_$columnName" * - * @param array $rows - * @param array $nameRows + * @param array> $rows + * @param array> $nameRows * @param string $prefix * * @return \eZ\Publish\SPI\Persistence\Content[] diff --git a/src/contracts/FieldType/DefaultDataFieldStorage.php b/src/contracts/FieldType/DefaultDataFieldStorage.php index 7c8ae9967a..25db0fa9d3 100644 --- a/src/contracts/FieldType/DefaultDataFieldStorage.php +++ b/src/contracts/FieldType/DefaultDataFieldStorage.php @@ -14,10 +14,11 @@ interface DefaultDataFieldStorage { /** - * Populates $field value property with default data based on the external data. - * $field->value is a {@link \eZ\Publish\SPI\Persistence\Content\FieldValue} object. - * This value holds the data as a {@link \eZ\Publish\Core\FieldType\Value} based object, according to - * the field type (e.g. for TextLine, it will be a {@link \eZ\Publish\Core\FieldType\TextLine\Value} object). + * Populates $field value property with default data based on the external data. + * + * $field->value is a {@see \eZ\Publish\SPI\Persistence\Content\FieldValue} object. + * This value holds the data as a {@see \eZ\Publish\Core\FieldType\Value} based object, according to + * the field type (e.g. for TextLine, it will be a {@see \eZ\Publish\Core\FieldType\TextLine\Value} object). */ public function getDefaultFieldData(VersionInfo $versionInfo, Field $field): void; } diff --git a/tests/lib/Persistence/Legacy/Content/Mapper/ResolveVirtualFieldSubscriberTest.php b/tests/lib/Persistence/Legacy/Content/Mapper/ResolveVirtualFieldSubscriberTest.php index 9f7fafff27..85a40c230b 100644 --- a/tests/lib/Persistence/Legacy/Content/Mapper/ResolveVirtualFieldSubscriberTest.php +++ b/tests/lib/Persistence/Legacy/Content/Mapper/ResolveVirtualFieldSubscriberTest.php @@ -33,12 +33,10 @@ public function testResolveVirtualField(): void $converterRegistry = $this->getConverterRegistry(); $storageRegistry = $this->createMock(StorageRegistry::class); - $storageRegistry->method('getStorage') - ->willReturn(new NullStorage()); + $storageRegistry->method('getStorage')->willReturn(new NullStorage()); $contentGateway = $this->createMock(ContentGateway::class); - $contentGateway->expects($this->never()) - ->method('insertNewField'); + $contentGateway->expects($this->never())->method('insertNewField'); $eventDispatcher = $this->getEventDispatcher( $converterRegistry, @@ -126,8 +124,7 @@ public function getIndexData(VersionInfo $versionInfo, Field $field, array $cont }); $contentGateway = $this->createMock(ContentGateway::class); - $contentGateway->expects($this->never()) - ->method('insertNewField'); + $contentGateway->expects($this->never())->method('insertNewField'); $eventDispatcher = $this->getEventDispatcher( $converterRegistry, @@ -178,8 +175,7 @@ public function testPersistEmptyExternalStorageField(): void $converterRegistry = $this->getConverterRegistry(); $storage = $this->createMock(FieldStorage::class); - $storage->expects($this->never()) - ->method('storeFieldData'); + $storage->expects($this->never())->method('storeFieldData'); $storage->expects($this->once()) ->method('getFieldData') @@ -190,12 +186,10 @@ public function testPersistEmptyExternalStorageField(): void }); $storageRegistry = $this->createMock(StorageRegistry::class); - $storageRegistry->method('getStorage') - ->willReturn($storage); + $storageRegistry->method('getStorage')->willReturn($storage); $contentGateway = $this->createMock(ContentGateway::class); - $contentGateway->expects($this->once()) - ->method('insertNewField') + $contentGateway->expects($this->once())->method('insertNewField') ->willReturn(567); $eventDispatcher = $this->getEventDispatcher( @@ -257,16 +251,13 @@ public function testPersistExternalStorageField(): void $field->value->externalData = $field->value->data; }); - $storage->expects($this->once()) - ->method('getFieldData'); + $storage->expects($this->once())->method('getFieldData'); $storageRegistry = $this->createMock(StorageRegistry::class); - $storageRegistry->method('getStorage') - ->willReturn($storage); + $storageRegistry->method('getStorage')->willReturn($storage); $contentGateway = $this->createMock(ContentGateway::class); - $contentGateway->expects($this->once()) - ->method('insertNewField') + $contentGateway->expects($this->once())->method('insertNewField') ->willReturn(456); $eventDispatcher = $this->getEventDispatcher(