Skip to content

Commit a727a4b

Browse files
committed
[BUGFIX] Fix tests for collection conversions
1 parent 13cf4bd commit a727a4b

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Tests/Unit/Utility/ComponentArgumentConverterTest.php

+15-11
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
namespace SMS\FluidComponents\Tests\Unit\Utility;
44

5+
use SMS\FluidComponents\Interfaces\ConstructibleFromArray;
6+
use SMS\FluidComponents\Utility\ComponentArgumentConverter;
57
use SMS\FluidComponents\Tests\Helpers\ComponentArgumentConverter\BaseObject;
6-
use SMS\FluidComponents\Tests\Helpers\ComponentArgumentConverter\BaseObjectConversionInterface;
7-
use SMS\FluidComponents\Tests\Helpers\ComponentArgumentConverter\DummyConversionInterface;
88
use SMS\FluidComponents\Tests\Helpers\ComponentArgumentConverter\DummyValue;
99
use SMS\FluidComponents\Tests\Helpers\ComponentArgumentConverter\SpecificObject;
10-
use SMS\FluidComponents\Utility\ComponentArgumentConverter;
10+
use SMS\FluidComponents\Tests\Helpers\ComponentArgumentConverter\DummyConversionInterface;
11+
use SMS\FluidComponents\Tests\Helpers\ComponentArgumentConverter\BaseObjectConversionInterface;
1112

1213
class ComponentArgumentConverterTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
1314
{
@@ -66,8 +67,9 @@ public function resolveTypeAliasCollection()
6667
public function addRemoveConversionInterface()
6768
{
6869
$this->assertEquals(
69-
false,
70-
$this->converter->canTypeBeConvertedToType('string', DummyValue::class)
70+
[],
71+
$this->converter->canTypeBeConvertedToType('string', DummyValue::class),
72+
'before conversion interface registration'
7173
);
7274

7375
$this->converter->addConversionInterface(
@@ -77,15 +79,17 @@ public function addRemoveConversionInterface()
7779
);
7880

7981
$this->assertEquals(
80-
true,
81-
$this->converter->canTypeBeConvertedToType('string', DummyValue::class)
82+
[DummyConversionInterface::class, 'fromString'],
83+
$this->converter->canTypeBeConvertedToType('string', DummyValue::class),
84+
'after conversion interface registration'
8285
);
8386

8487
$this->converter->removeConversionInterface('string');
8588

8689
$this->assertEquals(
87-
false,
88-
$this->converter->canTypeBeConvertedToType('string', DummyValue::class)
90+
[],
91+
$this->converter->canTypeBeConvertedToType('string', DummyValue::class),
92+
'after conversion interface removal'
8993
);
9094
}
9195

@@ -130,11 +134,11 @@ public function canTypeBeConvertedToType()
130134

131135
// Collections
132136
$this->assertEquals(
133-
[DummyConversionInterface::class, 'fromString'],
137+
[ConstructibleFromArray::class, 'fromArray'],
134138
$this->converter->canTypeBeConvertedToType('array', DummyValue::class . '[]')
135139
);
136140
$this->assertEquals(
137-
[DummyConversionInterface::class, 'fromString'],
141+
[ConstructibleFromArray::class, 'fromArray'],
138142
$this->converter->canTypeBeConvertedToType(\ArrayIterator::class, DummyValue::class . '[]')
139143
);
140144
$this->assertEquals(

0 commit comments

Comments
 (0)