Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
brookinsconsulting committed Sep 13, 2018
2 parents 6a038d0 + ea52019 commit 06b94d7
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions 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 06b94d7

Please sign in to comment.