2 declare(strict_types = 1);
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
36 $this->expectException(InvalidEnumerationValueException::class);
37 $this->expectExceptionCode(1381512753);
39 new Enumeration\MissingConstantsEnumeration();
47 $this->expectException(InvalidEnumerationValueException::class);
48 $this->expectExceptionCode(1381512761);
58 $this->expectException(InvalidEnumerationValueException::class);
59 $this->expectExceptionCode(1381512807);
61 new Enumeration\MissingConstantsEnumeration(2);
69 $this->expectException(InvalidEnumerationDefinitionException::class);
70 $this->expectExceptionCode(1381512797);
72 new Enumeration\InvalidConstantEnumeration(1);
80 $this->expectException(InvalidEnumerationValueException::class);
81 $this->expectExceptionCode(1381512753);
83 new Enumeration\MissingDefaultEnumeration();
91 $this->expectException(InvalidEnumerationDefinitionException::class);
92 $this->expectExceptionCode(1381512859);
94 new Enumeration\DuplicateConstantValueEnumeration(1);
106 Enumeration\CompleteEnumeration::INTEGER_VALUE,
110 Enumeration\CompleteEnumeration::INTEGER_VALUE,
114 Enumeration\CompleteEnumeration::STRING_INTEGER_VALUE,
118 Enumeration\CompleteEnumeration::STRING_INTEGER_VALUE,
122 Enumeration\CompleteEnumeration::STRING_VALUE,
135 $value =
new Enumeration\CompleteEnumeration($testValue);
137 $this->assertEquals((
string)$expectedValue, (
string)$value);
146 'INTEGER_VALUE' => 1,
147 'STRING_INTEGER_VALUE' =>
'2',
148 'STRING_VALUE' =>
'foo',
160 'INTEGER_VALUE' => 1,
161 'STRING_INTEGER_VALUE' =>
'2',
162 'STRING_VALUE' =>
'foo',
174 $enumeration =
new Enumeration\CompleteEnumeration();
176 'INTEGER_VALUE' => 1,
177 'STRING_INTEGER_VALUE' =>
'2',
178 'STRING_VALUE' =>
'foo',
181 $this->assertEquals($expected, $enumeration::getConstants());
190 $this->assertSame(
'1', $enumeration->__toString());
199 $this->assertInstanceOf(CompleteEnumeration::class, $enumeration);
207 $initialEnumeration =
new Enumeration\MissingDefaultEnumeration(1);
209 $this->assertInstanceOf(CompleteEnumeration::class, $enumeration);
219 $this->assertSame($initialEnumeration, $enumeration);
248 $this->assertTrue($enumeration->equals(1));
257 $this->assertTrue($enumeration->equals(
'1'));
267 $this->assertTrue($enumerationFoo->equals($enumerationBar));
277 $this->assertTrue($enumerationFoo->equals($enumerationBar));
287 $this->assertFalse($enumerationFoo->equals($enumerationBar));
297 $this->assertFalse($enumerationFoo->equals($enumerationBar));
306 $this->assertSame(
'INTEGER_VALUE', $result);
315 $this->assertSame(
'', $result);
324 $this->assertSame(
'Integer Value', $result);
333 $this->assertSame(
'', $result);