From ea520198004201141ef517653849aacebe7bdaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Tue, 11 Sep 2018 20:34:08 +0200 Subject: [PATCH] EZP-29104: Implemented ImageAsset Field Type (#2403) * EZP-29104: ImageAsset field type (tests) * EZP-29104: ImageAsset field type (implementation) * EZP-29104: Impl. \eZ\Publish\SPI\FieldType\Indexable for ezimageasset FT --- Tests/FieldType/ImageAssetIntegrationTest.php | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 Tests/FieldType/ImageAssetIntegrationTest.php diff --git a/Tests/FieldType/ImageAssetIntegrationTest.php b/Tests/FieldType/ImageAssetIntegrationTest.php new file mode 100644 index 000000000..424c79184 --- /dev/null +++ b/Tests/FieldType/ImageAssetIntegrationTest.php @@ -0,0 +1,112 @@ +createMock(ContentService::class); + $locationService = $this->createMock(LocationService::class); + $contentTypeService = $this->createMock(ContentTypeService::class); + + $config = []; + + $mapper = new FieldType\ImageAsset\AssetMapper( + $contentService, + $locationService, + $contentTypeService, + $config + ); + + $fieldType = new FieldType\ImageAsset\Type( + $contentService, + $contentTypeService, + $mapper + ); + + $fieldType->setTransformationProcessor($this->getTransformationProcessor()); + + return $this->getHandler( + 'ezimageasset', + $fieldType, + new ImageAssetConverter(), + new FieldType\NullStorage() + ); + } + + /** + * {@inheritdoc} + */ + public function getTypeConstraints() + { + return new Content\FieldTypeConstraints(); + } + + /** + * {@inheritdoc} + */ + public function getFieldDefinitionData() + { + return [ + ['fieldType', 'ezimageasset'], + ['fieldTypeConstraints', new Content\FieldTypeConstraints(['fieldSettings' => null])], + ]; + } + + /** + * {@inheritdoc} + */ + public function getInitialValue() + { + return new Content\FieldValue( + [ + 'data' => [ + 'destinationContentId' => 1, + ], + 'externalData' => null, + 'sortKey' => null, + ] + ); + } + + /** + * {@inheritdoc} + */ + public function getUpdatedValue() + { + return new Content\FieldValue( + [ + 'data' => [ + 'destinationContentId' => 2, + ], + 'externalData' => null, + 'sortKey' => null, + ] + ); + } +}