Skip to content

Commit

Permalink
[Tests] Fixed tests for Image field type
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Oct 24, 2023
1 parent a966134 commit 4a876d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException;
use Ibexa\Contracts\Core\Repository\Values\Content\Content;
use Ibexa\Contracts\Core\Repository\Values\Content\Field;
use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy;
use Ibexa\Core\FieldType\Image\Value as ImageValue;

/**
Expand Down Expand Up @@ -341,6 +342,7 @@ public function provideToHashData()
'width' => null,
'height' => null,
'additionalData' => [],
'mime' => null,
],
],
[
Expand All @@ -354,6 +356,7 @@ public function provideToHashData()
'uri' => "/$path",
'width' => 123,
'height' => 456,
'mime' => 'image/png',
]
),
[
Expand All @@ -368,6 +371,7 @@ public function provideToHashData()
'width' => 123,
'height' => 456,
'additionalData' => [],
'mime' => 'image/png',
],
],
];
Expand Down Expand Up @@ -573,6 +577,15 @@ public function testUpdateImageAltTextOnly(): void
);
}

protected function checkSearchEngineSupport(): void
{
if ($this->getSetupFactory() instanceof Legacy) {
$this->markTestSkipped(
"'ezimage' field type is not searchable with Legacy Search Engine"
);
}
}

protected function getValidSearchValueOne()
{
return new ImageValue(
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/FieldType/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public function provideInputForToHash()
'uri' => 'http://' . $this->getImageInputPath(),
'width' => 123,
'height' => 456,
'mime' => 'image/jpeg',
]
),
[
Expand All @@ -350,6 +351,7 @@ public function provideInputForToHash()
'width' => 123,
'height' => 456,
'additionalData' => [],
'mime' => 'image/jpeg',
],
],
// BC with 5.0 (EZP-20948). Path can be used as input instead of $inputUri.
Expand All @@ -362,6 +364,7 @@ public function provideInputForToHash()
'alternativeText' => 'This is so Sindelfingen!',
'imageId' => '123-12345',
'uri' => 'http://' . $this->getImageInputPath(),
'mime' => null,
]
),
[
Expand All @@ -376,6 +379,7 @@ public function provideInputForToHash()
'width' => null,
'height' => null,
'additionalData' => [],
'mime' => null,
],
],
];
Expand Down

0 comments on commit 4a876d1

Please sign in to comment.