mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
SimpleXML string casting in tests for older PHPUnit
This commit is contained in:
parent
3b59d4a762
commit
8f239d6373
@ -50,16 +50,16 @@ class XMLDataFormatterTest extends SapphireTest {
|
|||||||
$page->Content = 'This is some test content [test_shortcode]test[/test_shortcode]';
|
$page->Content = 'This is some test content [test_shortcode]test[/test_shortcode]';
|
||||||
|
|
||||||
$xml = new SimpleXMLElement('<?xml version="1.0"?>' . $formatter->convertDataObjectWithoutHeader($page));
|
$xml = new SimpleXMLElement('<?xml version="1.0"?>' . $formatter->convertDataObjectWithoutHeader($page));
|
||||||
$this->assertEquals('This is some test content test', $xml->Content);
|
$this->assertEquals('This is some test content test', (string)$xml->Content);
|
||||||
|
|
||||||
$page->Content = '[test_shortcode,id=-1]';
|
$page->Content = '[test_shortcode,id=-1]';
|
||||||
$xml = new SimpleXMLElement('<?xml version="1.0"?>' . $formatter->convertDataObjectWithoutHeader($page));
|
$xml = new SimpleXMLElement('<?xml version="1.0"?>' . $formatter->convertDataObjectWithoutHeader($page));
|
||||||
$this->assertEmpty('', $xml->Content);
|
$this->assertEmpty('', (string)$xml->Content);
|
||||||
|
|
||||||
$page->Content = '[bad_code,id=1]';
|
$page->Content = '[bad_code,id=1]';
|
||||||
|
|
||||||
$xml = new SimpleXMLElement('<?xml version="1.0"?>' . $formatter->convertDataObjectWithoutHeader($page));
|
$xml = new SimpleXMLElement('<?xml version="1.0"?>' . $formatter->convertDataObjectWithoutHeader($page));
|
||||||
$this->assertContains('[bad_code,id=1]', $xml->Content);
|
$this->assertContains('[bad_code,id=1]', (string)$xml->Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,16 +46,16 @@ class HtmlEditorFieldTest extends FunctionalTest {
|
|||||||
|
|
||||||
$parser = new CSSContentParser($obj->Content);
|
$parser = new CSSContentParser($obj->Content);
|
||||||
$xml = $parser->getByXpath('//img');
|
$xml = $parser->getByXpath('//img');
|
||||||
$this->assertEquals('', $xml[0]['alt'], 'Alt tags are added by default.');
|
$this->assertEquals('', (string)$xml[0]['alt'], 'Alt tags are added by default.');
|
||||||
$this->assertEquals('', $xml[0]['title'], 'Title tags are added by default.');
|
$this->assertEquals('', (string)$xml[0]['title'], 'Title tags are added by default.');
|
||||||
|
|
||||||
$editor->setValue('<img src="assets/example.jpg" alt="foo" title="bar" />');
|
$editor->setValue('<img src="assets/example.jpg" alt="foo" title="bar" />');
|
||||||
$editor->saveInto($obj);
|
$editor->saveInto($obj);
|
||||||
|
|
||||||
$parser = new CSSContentParser($obj->Content);
|
$parser = new CSSContentParser($obj->Content);
|
||||||
$xml = $parser->getByXpath('//img');
|
$xml = $parser->getByXpath('//img');
|
||||||
$this->assertEquals('foo', $xml[0]['alt'], 'Alt tags are preserved.');
|
$this->assertEquals('foo', (string)$xml[0]['alt'], 'Alt tags are preserved.');
|
||||||
$this->assertEquals('bar', $xml[0]['title'], 'Title tags are preserved.');
|
$this->assertEquals('bar', (string)$xml[0]['title'], 'Title tags are preserved.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMultiLineSaving() {
|
public function testMultiLineSaving() {
|
||||||
|
Loading…
Reference in New Issue
Block a user