Permalink
Browse files

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
  • Loading branch information...
adamwojs authored and alongosz committed Sep 11, 2018
1 parent dc44701 commit ea520198004201141ef517653849aacebe7bdaa2
Showing with 112 additions and 0 deletions.
  1. +112 −0 Tests/FieldType/ImageAssetIntegrationTest.php
@@ -0,0 +1,112 @@
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace eZ\Publish\SPI\Tests\FieldType;
use eZ\Publish\API\Repository\ContentService;
use eZ\Publish\API\Repository\ContentTypeService;
use eZ\Publish\API\Repository\LocationService;
use eZ\Publish\Core\FieldType;
use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageAssetConverter;
use eZ\Publish\SPI\Persistence\Content;
class ImageAssetIntegrationTest extends BaseIntegrationTest
{
/**
* {@inheritdoc}
*/
public function getTypeName()
{
return FieldType\ImageAsset\Type::FIELD_TYPE_IDENTIFIER;
}
/**
* {@inheritdoc}
*/
public function getCustomHandler()
{
$contentService = $this->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,
]
);
}
}

0 comments on commit ea52019

Please sign in to comment.