Permalink
Browse files

SimpleXML string casting in tests for older PHPUnit

  • Loading branch information...
1 parent 3b59d4a commit 8f239d63731e6a621aef784166e0ecbb382e5bd0 @chillu chillu committed Dec 17, 2012
Showing with 8 additions and 8 deletions.
  1. +4 −4 tests/api/XMLDataFormatterTest.php
  2. +4 −4 tests/forms/HtmlEditorFieldTest.php
@@ -39,7 +39,7 @@ public function testConvertDataObjectWithoutHeader() {
$this->assertEquals(
'<a href="http://mysite.com">mysite.com</a> is a link in this HTML content.'
. ' <![CDATA[this is some nested CDATA]]>',
- (string) $xml->Content
+ (string)$xml->Content
);
}
@@ -50,16 +50,16 @@ public function testShortcodesInDataObject() {
$page->Content = 'This is some test content [test_shortcode]test[/test_shortcode]';
$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]';
$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]';
$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 @@ public function testImageInsertion() {
$parser = new CSSContentParser($obj->Content);
$xml = $parser->getByXpath('//img');
- $this->assertEquals('', $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]['alt'], 'Alt 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->saveInto($obj);
$parser = new CSSContentParser($obj->Content);
$xml = $parser->getByXpath('//img');
- $this->assertEquals('foo', $xml[0]['alt'], 'Alt tags are preserved.');
- $this->assertEquals('bar', $xml[0]['title'], 'Title tags are preserved.');
+ $this->assertEquals('foo', (string)$xml[0]['alt'], 'Alt tags are preserved.');
+ $this->assertEquals('bar', (string)$xml[0]['title'], 'Title tags are preserved.');
}
public function testMultiLineSaving() {

0 comments on commit 8f239d6

Please sign in to comment.