PHP Class eZ\Publish\Core\FieldType\Tests\PageTest

Inheritance: extends FieldTypeTest
Show file Open project: ezsystems/ezpublish-kernel

Protected Properties

Property Type Description
$hashReference
$pageReference eZ\Publish\Core\FieldType\Page\Parts\Page

Public Methods

Method Description
provideDataForGetName ( )
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.
provideInvalidInputForAcceptValue ( ) : array Data provider for invalid input to acceptValue().
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().
providerForTestIsEmptyValue ( ) : array Data provider for valid input to isEmptyValue().
testIsEmptyValue ( $value, $state )

Protected Methods

Method Description
createFieldTypeUnderTest ( ) : FieldType Returns the field type under test.
getEmptyValueExpectation ( ) Returns the empty value expected from the field type.
getHashReference ( )
getPageReference ( )
getSettingsSchemaExpectation ( ) : array Returns the settings schema expected from the field type.
getValidatorConfigurationSchemaExpectation ( ) : array Returns the validator configuration schema expected from the field type.
provideFieldTypeIdentifier ( )

Private Methods

Method Description
getPageServiceMock ( )

Method Details

createFieldTypeUnderTest() protected method

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!
protected createFieldTypeUnderTest ( ) : FieldType
return FieldType

getEmptyValueExpectation() protected method

Returns the empty value expected from the field type.
protected getEmptyValueExpectation ( )

getHashReference() protected method

protected getHashReference ( )

getPageReference() protected method

protected getPageReference ( )

getSettingsSchemaExpectation() protected method

Returns the settings schema expected from the field type.
protected getSettingsSchemaExpectation ( ) : array
return array

getValidatorConfigurationSchemaExpectation() protected method

Returns the validator configuration schema expected from the field type.

provideDataForGetName() public method

provideFieldTypeIdentifier() protected method

provideInValidFieldSettings() public method

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() public method

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', ) ) ), ... );
public provideInputForFromHash ( ) : array
return array

provideInputForToHash() public method

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', ) ), ... );
public provideInputForToHash ( ) : array
return array

provideInvalidInputForAcceptValue() public method

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', ), ... );

provideValidFieldSettings() public method

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
return array

provideValidInputForAcceptValue() public method

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', ) ) ), ... );

providerForTestIsEmptyValue() public method

Returns an array of data provider sets with 2 arguments: 1. The valid input to isEmptyValue() 2. The expected return value from isEmptyValue() For example: return array( array( new PageValue(), true ), array( new PageValue( $this->getPageReference() ), false ), ... );

testIsEmptyValue() public method

public testIsEmptyValue ( $value, $state )

Property Details

$hashReference protected property

protected $hashReference

$pageReference protected property

protected Page,eZ\Publish\Core\FieldType\Page\Parts $pageReference
return eZ\Publish\Core\FieldType\Page\Parts\Page