Completed
Push — master ( 895cca...4892d1 )
by
unknown
34:47
created

ImageAssetIntegrationTest::getTypeConstraints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\SPI\Tests\FieldType;
10
11
use eZ\Publish\API\Repository\ContentService;
12
use eZ\Publish\API\Repository\ContentTypeService;
13
use eZ\Publish\API\Repository\LocationService;
14
use eZ\Publish\Core\FieldType;
15
use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageAssetConverter;
16
use eZ\Publish\SPI\Persistence\Content;
17
18
class ImageAssetIntegrationTest extends BaseIntegrationTest
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function getTypeName()
24
    {
25
        return FieldType\ImageAsset\Type::FIELD_TYPE_IDENTIFIER;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getCustomHandler()
32
    {
33
        $contentService = $this->createMock(ContentService::class);
34
        $locationService = $this->createMock(LocationService::class);
35
        $contentTypeService = $this->createMock(ContentTypeService::class);
36
37
        $config = [];
38
39
        $mapper = new FieldType\ImageAsset\AssetMapper(
40
            $contentService,
41
            $locationService,
42
            $contentTypeService,
43
            $config
44
        );
45
46
        $fieldType = new FieldType\ImageAsset\Type(
47
            $contentService,
48
            $contentTypeService,
49
            $mapper
50
        );
51
52
        $fieldType->setTransformationProcessor($this->getTransformationProcessor());
53
54
        return $this->getHandler(
55
            'ezimageasset',
56
            $fieldType,
57
            new ImageAssetConverter(),
58
            new FieldType\NullStorage()
59
        );
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function getTypeConstraints()
66
    {
67
        return new Content\FieldTypeConstraints();
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function getFieldDefinitionData()
74
    {
75
        return [
76
            ['fieldType', 'ezimageasset'],
77
            ['fieldTypeConstraints', new Content\FieldTypeConstraints(['fieldSettings' => null])],
78
        ];
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84 View Code Duplication
    public function getInitialValue()
85
    {
86
        return new Content\FieldValue(
87
            [
88
                'data' => [
89
                    'destinationContentId' => 1,
90
                ],
91
                'externalData' => null,
92
                'sortKey' => null,
93
            ]
94
        );
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100 View Code Duplication
    public function getUpdatedValue()
101
    {
102
        return new Content\FieldValue(
103
            [
104
                'data' => [
105
                    'destinationContentId' => 2,
106
                ],
107
                'externalData' => null,
108
                'sortKey' => null,
109
            ]
110
        );
111
    }
112
}
113