PHP Class eZ\Publish\Core\FieldType\Tests\RichText\Converter\Xslt\BaseTest

Inheritance: extends PHPUnit_Framework_TestCas\PHPUnit_Framework_TestCase
Datei anzeigen Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$converter eZ\Publish\Core\FieldType\RichText\Converter
$validator eZ\Publish\Core\FieldType\RichText\Validator

Public Methods

Method Description
getFixtureSubdirectories ( ) : array Returns subdirectories for input and output fixtures.
providerForTestConvert ( ) : array Provider for conversion test.
testConvert ( string $inputFile, string $outputFile )

Protected Methods

Method Description
createDocument ( string $xmlFile ) : DOMDocument
formatValidationErrors ( $outputFile, array $errors )
getConversionTransformationStylesheet ( ) : string Return the absolute path to conversion transformation stylesheet.
getConversionValidationSchema ( ) : string[] Return an array of absolute paths to conversion result validation schemas.
getConversionValidator ( ) : Validator
getConverter ( ) : Xslt
getCustomConversionTransformationStylesheets ( ) : array Return custom XSLT stylesheets configuration.
removeComments ( DOMDocument $document )

Method Details

createDocument() protected method

protected createDocument ( string $xmlFile ) : DOMDocument
$xmlFile string
return DOMDocument

formatValidationErrors() protected method

protected formatValidationErrors ( $outputFile, array $errors )
$errors array

getConversionTransformationStylesheet() abstract protected method

Return the absolute path to conversion transformation stylesheet.
abstract protected getConversionTransformationStylesheet ( ) : string
return string

getConversionValidationSchema() protected method

Return an array of absolute paths to conversion result validation schemas.
protected getConversionValidationSchema ( ) : string[]
return string[]

getConversionValidator() protected method

protected getConversionValidator ( ) : Validator
return eZ\Publish\Core\FieldType\RichText\Validator

getConverter() protected method

protected getConverter ( ) : Xslt
return eZ\Publish\Core\FieldType\RichText\Converter\Xslt

getCustomConversionTransformationStylesheets() protected method

Stylesheet paths must be absolute. Code example: array( array( "path" => __DIR__ . "/core.xsl", "priority" => 100 ), array( "path" => __DIR__ . "/custom.xsl", "priority" => 99 ), )

getFixtureSubdirectories() abstract public method

The test will try to match each XML file in input directory with the file of the same name in the output directory. It is possible to test lossy conversion as well (say legacy ezxml). To use this filename of the fixture that is converted with data loss needs to end with .lossy.xml. As input test with this fixture will be skipped, but as output fixture it will be matched to the input fixture file of the same name but without .lossy part. If input file could not be matched with output file, test will be marked as incomplete, meaning pairing of fixtures is expected. To implement additional tests for lossy conversion put the test fixtures inside "lossy" subdirectory in the input directory. This directory needs to contain both source and destination fixtures, matched by the filename and part of the filename directly before the file extension. This part of the filename will be matched from the name of fixture subdirectories. Example for conversion from ezxml to docbook: .../_fixtures/ezxml/lossy/001-sectionNested.ezxml.xml will be converted to with: .../_fixtures/ezxml/lossy/001-sectionNested.docbook.xml Comments in fixtures are removed before conversion, so be free to use comments inside fixtures for documentation as needed. Example: return array( "input" => "docbook", "output" => "ezxml" );
abstract public getFixtureSubdirectories ( ) : array
return array

providerForTestConvert() public method

Provider for conversion test.
public providerForTestConvert ( ) : array
return array

removeComments() protected method

protected removeComments ( DOMDocument $document )
$document DOMDocument

testConvert() public method

public testConvert ( string $inputFile, string $outputFile )
$inputFile string
$outputFile string

Property Details

$converter protected_oe property

protected Converter,eZ\Publish\Core\FieldType\RichText $converter
return eZ\Publish\Core\FieldType\RichText\Converter

$validator protected_oe property

protected Validator,eZ\Publish\Core\FieldType\RichText $validator
return eZ\Publish\Core\FieldType\RichText\Validator