2 declare(strict_types = 1);
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
29 private static $tca = [
30 'title' =>
'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.crop_variant.default',
37 'allowedAspectRatios' => [
39 'title' =>
'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.16_9',
40 'value' => 1.777777777777777
43 'title' =>
'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
44 'value' => 1.333333333333333
47 'title' =>
'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.1_1',
51 'title' =>
'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
55 'selectedRatio' =>
'16:9',
80 $this->assertInstanceOf(CropVariantCollection::class, $cropVariantCollection);
82 $assertSameValues =
function ($expected, $actual) use (&$assertSameValues) {
83 if (is_array($expected)) {
84 foreach ($expected as $key => $value) {
85 $this->assertArrayHasKey($key, $actual);
86 $assertSameValues($expected[$key], $actual[$key]);
89 $this->assertSame($expected, $actual);
93 $assertSameValues([
'default' => $cropVariant1,
'Second' => $cropVariant2], $cropVariantCollection->asArray());
101 $this->expectException(InvalidConfigurationException::class);
102 $cropVariant1 =
new CropVariant(
'foo',
'title 1',
new Area(0.0, 0.0, 1.0, 1.0));
103 $cropVariant2 =
new CropVariant(
'foo',
'title 2',
new Area(0.0, 0.0, 0.5, 0.5));
121 $this->assertSame(
'[]', (
string)$variants);