forked from ezsystems/ezpublish-kernel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ezsystems#1087 from ezsystems/fix-EZP-23513-xmltex…
…t-paragraphs Fix EZP-23513: embed rendering (XmlText)
- Loading branch information
Showing
118 changed files
with
3,333 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
eZ/Publish/Core/FieldType/Tests/XmlText/Converter/CustomTagsTest.php
This file was deleted.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
eZ/Publish/Core/FieldType/Tests/XmlText/Converter/EmbedLinkingTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
/** | ||
* File containing the EmbedLinking converter test | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
* @version //autogentag// | ||
*/ | ||
|
||
namespace eZ\Publish\Core\FieldType\Tests\XmlText\Converter; | ||
|
||
use eZ\Publish\Core\FieldType\XmlText\Converter\EmbedLinking; | ||
use PHPUnit_Framework_TestCase; | ||
use DOMDocument; | ||
|
||
/** | ||
* Tests the EmbedLinking converter | ||
*/ | ||
class EmbedLinkingTest extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Provider for conversion test. | ||
* | ||
* @return array | ||
*/ | ||
public function providerForTestConvert() | ||
{ | ||
$map = array(); | ||
|
||
foreach ( glob( __DIR__ . "/_fixtures/embed_linking/input/*.xml" ) as $inputFilePath ) | ||
{ | ||
$basename = basename( $inputFilePath, ".xml" ); | ||
$outputFilePath = __DIR__ . "/_fixtures/embed_linking/output/{$basename}.xml"; | ||
|
||
$map[] = array( $inputFilePath, $outputFilePath ); | ||
} | ||
|
||
return $map; | ||
} | ||
|
||
/** | ||
* @param string $xml | ||
* @param boolean $isPath | ||
* | ||
* @return \DOMDocument | ||
*/ | ||
protected function createDocument( $xml, $isPath = true ) | ||
{ | ||
$document = new DOMDocument(); | ||
|
||
$document->preserveWhiteSpace = false; | ||
$document->formatOutput = false; | ||
|
||
if ( $isPath === true ) | ||
{ | ||
$xml = file_get_contents( $xml ); | ||
} | ||
|
||
$document->loadXml( $xml ); | ||
|
||
return $document; | ||
} | ||
|
||
/** | ||
* @param string $inputFilePath | ||
* @param string $outputFilePath | ||
* | ||
* @dataProvider providerForTestConvert | ||
*/ | ||
public function testConvert( $inputFilePath, $outputFilePath ) | ||
{ | ||
$inputDocument = $this->createDocument( $inputFilePath ); | ||
|
||
$converter = new EmbedLinking(); | ||
$converter->convert( $inputDocument ); | ||
|
||
$outputDocument = $this->createDocument( $outputFilePath ); | ||
|
||
$this->assertEquals( | ||
$outputDocument, | ||
$inputDocument | ||
); | ||
} | ||
} |
Oops, something went wrong.