PHP 클래스 eZ\Publish\Core\FieldType\Tests\FieldTypeTest

상속: extends PHPUnit_Framework_TestCas\PHPUnit_Framework_TestCase
파일 보기 프로젝트 열기: ezsystems/ezpublish-kernel 1 사용 예제들

공개 메소드들

메소드 설명
provideDataForGetName ( ) : array Provides data for the getName() test.
provideInValidFieldSettings ( ) : array Provide data sets with field settings which are considered invalid by the {@link validateFieldSettings()} method. The method must return a non-empty array of validation error when receiving such field settings.
provideInputForFromHash ( ) : array Provide input to fromHash() method.
provideInputForToHash ( ) : array Provide input for the toHash() method.
provideInvalidDataForValidate ( ) : array Provides data sets with validator configuration and/or field settings, field value and corresponding validation errors returned by the {@link validate()} method.
provideInvalidInputForAcceptValue ( ) : array Data provider for invalid input to acceptValue().
provideInvalidValidatorConfiguration ( ) : array Provide data sets with validator configurations which are considered invalid by the {@link validateValidatorConfiguration()} method. The method must return a non-empty array of valiation errors when receiving one of the provided values.
provideValidDataForValidate ( ) : array Provides data sets with validator configuration and/or field settings and field value which are considered valid by the {@link validate()} method.
provideValidFieldSettings ( ) : array Provide data sets with field settings which are considered valid by the {@link validateFieldSettings()} method.
provideValidInputForAcceptValue ( ) : array Data provider for valid input to acceptValue().
provideValidValidatorConfiguration ( ) : array Provide data sets with validator configurations which are considered valid by the {@link validateValidatorConfiguration()} method.
testAcceptGetEmptyValue ( ) Tests that default empty value is unchanged by acceptValue() method.
testAcceptValue ( mixed $inputValue, mixed $expectedOutputValue )
testAcceptValueFailsOnInvalidValues ( mixed $inputValue, Exception $expectedException )
testEmptyValue ( )
testEmptyValueIsEmpty ( )
testFieldSettingsFromHash ( $inputSettings )
testFieldSettingsToHash ( $inputSettings )
testFromHash ( $inputHash, array $expectedResult )
testGetFieldTypeIdentifier ( )
testGetName ( eZ\Publish\SPI\FieldType\Value $value, string $expected )
testSettingsSchema ( )
testToHash ( mixed $inputValue, array $expectedResult )
testValidateFieldSettingsInvalid ( mixed $inputSettings )
testValidateFieldSettingsValid ( mixed $inputSettings )
testValidateInvalid ( $fieldDefinitionData, $value, $errors )
testValidateValid ( $fieldDefinitionData, $value )
testValidateValidatorConfigurationInvalid ( mixed $inputConfiguration )
testValidateValidatorConfigurationValid ( mixed $inputConfiguration )
testValidatorConfigurationFromHash ( mixed $inputConfiguration )
testValidatorConfigurationSchema ( )
testValidatorConfigurationToHash ( mixed $inputConfiguration )

보호된 메소드들

메소드 설명
assertIsValidHashValue ( mixed $actualHash, array $keyChain = [] ) Asserts that the given $actualHash complies to the rules for hashes.
createFieldTypeUnderTest ( ) : FieldType Returns the field type under test.
doValidate ( $fieldDefinitionData, $value )
getEmptyValueExpectation ( ) : mixed Returns the empty value expected from the field type.
getFieldTypeUnderTest ( ) : eZ\Publish\SPI\FieldType\FieldType Retrieves a test wide cached version of the field type under test.
getSettingsSchemaExpectation ( ) : array Returns the settings schema expected from the field type.
getTransformationProcessorMock ( ) : TransformationProcessor | PHPUnit_Framework_MockObject_MockObject
getValidatorConfigurationSchemaExpectation ( ) : array Returns the validator configuration schema expected from the field type.
provideFieldTypeIdentifier ( ) : string Returns the identifier of the field type under test.

메소드 상세

assertIsValidHashValue() 보호된 메소드

Asserts that the given $actualHash complies to the rules for hashes.
protected assertIsValidHashValue ( mixed $actualHash, array $keyChain = [] )
$actualHash mixed
$keyChain array

createFieldTypeUnderTest() 추상적인 보호된 메소드

This method is used by all test cases to retrieve the field type under test. Just create the FieldType instance using mocks from the provided get*Mock() methods and/or custom get*Mock() implementations. You MUST NOT take care for test case wide caching of the field type, just return a new instance from this method!
abstract protected createFieldTypeUnderTest ( ) : FieldType
리턴 FieldType

doValidate() 보호된 메소드

protected doValidate ( $fieldDefinitionData, $value )

getEmptyValueExpectation() 추상적인 보호된 메소드

Returns the empty value expected from the field type.
abstract protected getEmptyValueExpectation ( ) : mixed
리턴 mixed

getFieldTypeUnderTest() 보호된 메소드

Uses {@link createFieldTypeUnderTest()} to create the instance initially.
protected getFieldTypeUnderTest ( ) : eZ\Publish\SPI\FieldType\FieldType
리턴 eZ\Publish\SPI\FieldType\FieldType

getSettingsSchemaExpectation() 추상적인 보호된 메소드

Returns the settings schema expected from the field type.
abstract protected getSettingsSchemaExpectation ( ) : array
리턴 array

getTransformationProcessorMock() 보호된 메소드

protected getTransformationProcessorMock ( ) : TransformationProcessor | PHPUnit_Framework_MockObject_MockObject
리턴 eZ\Publish\Core\Persistence\TransformationProcessor | PHPUnit_Framework_MockObject_MockObject

getValidatorConfigurationSchemaExpectation() 추상적인 보호된 메소드

Returns the validator configuration schema expected from the field type.
abstract protected getValidatorConfigurationSchemaExpectation ( ) : array
리턴 array

provideDataForGetName() 추상적인 공개 메소드

Provides data for the getName() test.
abstract public provideDataForGetName ( ) : array
리턴 array

provideFieldTypeIdentifier() 추상적인 보호된 메소드

Returns the identifier of the field type under test.
abstract protected provideFieldTypeIdentifier ( ) : string
리턴 string

provideInValidFieldSettings() 공개 메소드

ATTENTION: This is a default implementation, which must be overwritten if a FieldType supports field settings! Returns an array of data provider sets with a single argument: A valid set of field settings. For example: return array( array( true, ), array( array( 'nonExistentKey' => 2 ) ), ... );

provideInputForFromHash() 추상적인 공개 메소드

Returns an array of data provider sets with 2 arguments: 1. The valid input to fromHash(), 2. The expected return value from fromHash(). For example: return array( array( null, null ), array( array( 'path' => 'some/file/here', 'fileName' => 'sindelfingen.jpg', 'fileSize' => 2342, 'downloadCount' => 0, 'mimeType' => 'image/jpeg', ), new BinaryFileValue( array( 'path' => 'some/file/here', 'fileName' => 'sindelfingen.jpg', 'fileSize' => 2342, 'downloadCount' => 0, 'mimeType' => 'image/jpeg', ) ) ), ... );
abstract public provideInputForFromHash ( ) : array
리턴 array

provideInputForToHash() 추상적인 공개 메소드

Returns an array of data provider sets with 2 arguments: 1. The valid input to toHash(), 2. The expected return value from toHash(). For example: return array( array( null, null ), array( new BinaryFileValue( array( 'path' => 'some/file/here', 'fileName' => 'sindelfingen.jpg', 'fileSize' => 2342, 'downloadCount' => 0, 'mimeType' => 'image/jpeg', ) ), array( 'path' => 'some/file/here', 'fileName' => 'sindelfingen.jpg', 'fileSize' => 2342, 'downloadCount' => 0, 'mimeType' => 'image/jpeg', ) ), ... );
abstract public provideInputForToHash ( ) : array
리턴 array

provideInvalidDataForValidate() 공개 메소드

ATTENTION: This is a default implementation, which must be overwritten if a FieldType supports validation! For example: return array( array( array( "validatorConfiguration" => array( "IntegerValueValidator" => array( "minIntegerValue" => 5, "maxIntegerValue" => 10 ), ), ), new IntegerValue( 3 ), array( new ValidationError( "The value can not be lower than %size%.", null, array( "%size%" => 5 ), ), ), ), array( array( "fieldSettings" => array( "isMultiple" => false ), ), new CountryValue( "BE" => array( "Name" => "Belgium", "Alpha2" => "BE", "Alpha3" => "BEL", "IDC" => 32, ), "FR" => array( "Name" => "France", "Alpha2" => "FR", "Alpha3" => "FRA", "IDC" => 33, ), ) ), array( new ValidationError( "Field definition does not allow multiple countries to be selected." ), ), ... );

provideInvalidInputForAcceptValue() 추상적인 공개 메소드

Returns an array of data provider sets with 2 arguments: 1. The invalid input to acceptValue(), 2. The expected exception type as a string. For example: return array( array( new \stdClass(), 'eZ\\Publish\\Core\\Base\\Exceptions\\InvalidArgumentException', ), array( array(), 'eZ\\Publish\\Core\\Base\\Exceptions\\InvalidArgumentException', ), ... );
abstract public provideInvalidInputForAcceptValue ( ) : array
리턴 array

provideInvalidValidatorConfiguration() 공개 메소드

ATTENTION: This is a default implementation, which must be overwritten if a FieldType supports validators! Returns an array of data provider sets with a single argument: A valid set of validator configurations. For example: return array( array( array( 'NonExistentValidator' => array(), ), ), array( array( Typos 'InTEgervALUeVALIdator' => array( 'minIntegerValue' => 0, 'maxIntegerValue' => 23, ) ) ), array( array( 'IntegerValueValidator' => array( Incorrect value types 'minIntegerValue' => true, 'maxIntegerValue' => false, ) ) ), ... );

provideValidDataForValidate() 공개 메소드

ATTENTION: This is a default implementation, which must be overwritten if a FieldType supports validation! For example: return array( array( array( "validatorConfiguration" => array( "StringLengthValidator" => array( "minStringLength" => 2, "maxStringLength" => 10, ), ), ), new TextLineValue( "lalalala" ), ), array( array( "fieldSettings" => array( 'isMultiple' => true ), ), new CountryValue( array( "BE" => array( "Name" => "Belgium", "Alpha2" => "BE", "Alpha3" => "BEL", "IDC" => 32, ), ), ), ), ... );

provideValidFieldSettings() 공개 메소드

ATTENTION: This is a default implementation, which must be overwritten if a FieldType supports field settings! Returns an array of data provider sets with a single argument: A valid set of field settings. For example: return array( array( array(), ), array( array( 'rows' => 2 ) ), ... );
public provideValidFieldSettings ( ) : array
리턴 array

provideValidInputForAcceptValue() 추상적인 공개 메소드

Returns an array of data provider sets with 2 arguments: 1. The valid input to acceptValue(), 2. The expected return value from acceptValue(). For example: return array( array( null, null ), array( __FILE__, new BinaryFileValue( array( 'path' => __FILE__, 'fileName' => basename( __FILE__ ), 'fileSize' => filesize( __FILE__ ), 'downloadCount' => 0, 'mimeType' => 'text/plain', ) ) ), ... );
abstract public provideValidInputForAcceptValue ( ) : array
리턴 array

provideValidValidatorConfiguration() 공개 메소드

ATTENTION: This is a default implementation, which must be overwritten if a FieldType supports validators! Returns an array of data provider sets with a single argument: A valid set of validator configurations. For example: return array( array( array(), ), array( array( 'IntegerValueValidator' => array( 'minIntegerValue' => 0, 'maxIntegerValue' => 23, ) ) ), ... );

testAcceptGetEmptyValue() 공개 메소드

Tests that default empty value is unchanged by acceptValue() method.

testAcceptValue() 공개 메소드

public testAcceptValue ( mixed $inputValue, mixed $expectedOutputValue )
$inputValue mixed
$expectedOutputValue mixed

testAcceptValueFailsOnInvalidValues() 공개 메소드

public testAcceptValueFailsOnInvalidValues ( mixed $inputValue, Exception $expectedException )
$inputValue mixed
$expectedException Exception

testEmptyValue() 공개 메소드

public testEmptyValue ( )

testEmptyValueIsEmpty() 공개 메소드

testFieldSettingsFromHash() 공개 메소드

public testFieldSettingsFromHash ( $inputSettings )

testFieldSettingsToHash() 공개 메소드

public testFieldSettingsToHash ( $inputSettings )

testFromHash() 공개 메소드

public testFromHash ( $inputHash, array $expectedResult )
$expectedResult array

testGetFieldTypeIdentifier() 공개 메소드

testGetName() 공개 메소드

public testGetName ( eZ\Publish\SPI\FieldType\Value $value, string $expected )
$value eZ\Publish\SPI\FieldType\Value
$expected string

testSettingsSchema() 공개 메소드

public testSettingsSchema ( )

testToHash() 공개 메소드

public testToHash ( mixed $inputValue, array $expectedResult )
$inputValue mixed
$expectedResult array

testValidateFieldSettingsInvalid() 공개 메소드

public testValidateFieldSettingsInvalid ( mixed $inputSettings )
$inputSettings mixed

testValidateFieldSettingsValid() 공개 메소드

public testValidateFieldSettingsValid ( mixed $inputSettings )
$inputSettings mixed

testValidateInvalid() 공개 메소드

public testValidateInvalid ( $fieldDefinitionData, $value, $errors )

testValidateValid() 공개 메소드

public testValidateValid ( $fieldDefinitionData, $value )

testValidateValidatorConfigurationInvalid() 공개 메소드

public testValidateValidatorConfigurationInvalid ( mixed $inputConfiguration )
$inputConfiguration mixed

testValidateValidatorConfigurationValid() 공개 메소드

public testValidateValidatorConfigurationValid ( mixed $inputConfiguration )
$inputConfiguration mixed

testValidatorConfigurationFromHash() 공개 메소드

public testValidatorConfigurationFromHash ( mixed $inputConfiguration )
$inputConfiguration mixed

testValidatorConfigurationSchema() 공개 메소드

testValidatorConfigurationToHash() 공개 메소드

public testValidatorConfigurationToHash ( mixed $inputConfiguration )
$inputConfiguration mixed