30 new Enumeration\MissingConstantsEnumeration();
38 new Enumeration\CompleteEnumeration(
'bar');
46 new Enumeration\MissingConstantsEnumeration(2);
54 new Enumeration\InvalidConstantEnumeration(1);
62 new Enumeration\MissingDefaultEnumeration();
70 new Enumeration\DuplicateConstantValueEnumeration(1);
78 'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration',
82 $enumClassName = get_class($enumeration);
84 $expectedValue = array(
86 'STRING_VALUE' =>
'foo',
90 $result = $enumeration->_getStatic(
'enumConstants');
91 $this->assertArrayHasKey($enumClassName,
$result);
92 $this->assertSame($expectedValue,
$result[$enumClassName]);
100 'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration',
104 $this->assertEquals(1, $enumeration->_get(
'value'));
112 'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration',
116 $enumeration->_call(
'setValue',
'foo');
117 $this->assertEquals(
'foo', $enumeration->_get(
'value'));
126 'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration',
130 $enumeration->_call(
'setValue', 2);
131 $this->assertEquals(2, $enumeration->_get(
'value'));
197 $mockName = $this->
getUniqueId(
'CompleteEnumerationMock');
199 'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration',
205 $enumeration->_setStatic(
'enumConstants', array($mockName => array(
'CONSTANT_NAME' => $enumerationValue)));
206 $enumeration->_set(
'value', $enumerationValue);
207 $this->assertSame($expectation, $enumeration->_call(
'isValid', $testValue));
228 $enumeration =
new Enumeration\CompleteEnumeration();
229 $this->assertEquals(array(
'INTEGER_VALUE' => 1,
'STRING_VALUE' =>
'foo'), $enumeration->getConstants());
236 $enumeration =
new Enumeration\CompleteEnumeration();
237 $this->assertSame(
'1', $enumeration->__toString());
244 $enumeration = Enumeration\CompleteEnumeration::cast(1);
245 $this->assertInstanceOf(
'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration', $enumeration);
252 $initialEnumeration =
new Enumeration\MissingDefaultEnumeration(1);
253 $enumeration = Enumeration\CompleteEnumeration::cast($initialEnumeration);
254 $this->assertInstanceOf(
'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration', $enumeration);
261 $initialEnumeration =
new Enumeration\CompleteEnumeration(1);
262 $enumeration = Enumeration\CompleteEnumeration::cast($initialEnumeration);
263 $this->assertSame($initialEnumeration, $enumeration);
271 'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration',
275 $this->assertSame(1, $enumeration->_get(
'value'));
283 'TYPO3\\CMS\\Core\\Tests\\Unit\\Type\\Fixture\\Enumeration\\CompleteEnumeration',
287 $this->assertSame(1, $enumeration->_get(
'value'));
294 $enumeration =
new Enumeration\CompleteEnumeration(1);
295 $this->assertTrue($enumeration->equals(1));
302 $enumeration =
new Enumeration\CompleteEnumeration(1);
303 $this->assertTrue($enumeration->equals(
'1'));
310 $enumerationFoo =
new Enumeration\CompleteEnumeration(1);
311 $enumerationBar =
new Enumeration\CompleteEnumeration(1);
312 $this->assertTrue($enumerationFoo->equals($enumerationBar));
319 $enumerationFoo =
new Enumeration\CompleteEnumeration(1);
320 $enumerationBar =
new Enumeration\MissingDefaultEnumeration(1);
321 $this->assertTrue($enumerationFoo->equals($enumerationBar));
328 $enumerationFoo =
new Enumeration\CompleteEnumeration(
'foo');
329 $enumerationBar =
new Enumeration\MissingDefaultEnumeration(1);
330 $this->assertFalse($enumerationFoo->equals($enumerationBar));
337 $enumerationFoo =
new Enumeration\CompleteEnumeration(1);
338 $enumerationBar =
new Enumeration\CompleteEnumeration(
'foo');
339 $this->assertFalse($enumerationFoo->equals($enumerationBar));
equalsReturnsFalseIfDifferentEnumerationWithDifferentValueIsGiven()
constructorThrowsExceptionIfNoConstantsAreDefined()
equalsReturnsTrueIfDifferentEnumerationWithSameValueIsGiven()
castCastsIntegerToEnumerationWithCorrespondingValue()
isValidComparisonExpectations()
castCastsStringToEnumerationWithCorrespondingValue()
static getConstants($include_default=FALSE)
setValueToAnInvalidValueThrowsException()
castReturnsGivenObjectIfCalledWithValueOfSameType()
loadValuesThrowsExceptionIfNoDefaultConstantIsDefinedAndNoValueIsGiven()
getConstantsReturnsArrayOfPossibleValuesWithDefaultIfRequested()
getConstantsReturnsArrayOfPossibleValuesWithoutDefault()
equalsReturnsTrueIfEqualEnumerationIsGiven()
equalsReturnsTrueIfStringIsGivenThatEqualsEnumerationsIntegerValue()
toStringReturnsValueAsString()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
equalsReturnsFalseIfEnumerationOfSameTypeWithDifferentValueIsGiven()
loadValuesThrowsExceptionIfDisallowedTypeIsDefinedAsConstant()
castReturnsObjectOfCalledEnumerationTypeIfCalledWithValueOfDifferentType()
equalsReturnsTrueIfIntegerIsGivenThatEqualsEnumerationsIntegerValue()
getConstantsCanBeCalledOnInstances()
loadValuesThrowsExceptionIfGivenValueIsNotAvailableInEnumeration()
castReturnsObjectOfEnumerationTypeIfSimpleValueIsGiven()
isValidDoesTypeLooseComparison($enumerationValue, $testValue, $expectation)
loadValuesThrowsExceptionIfValueIsDefinedMultipleTimes()
loadValuesSetsStaticEnumConstants()
constructorThrowsExceptionIfInvalidValueIsRequested()