Permalink
Browse files

String casting in SimpleXML tests for older phpunit versions

  • Loading branch information...
1 parent 83febef commit 894d48789c340f6e9040fa57f090cbea5e69c0c7 @chillu chillu committed Dec 17, 2012
Showing with 12 additions and 12 deletions.
  1. +12 −12 tests/model/SiteTreeHTMLEditorFieldTest.php
@@ -53,18 +53,18 @@ public function testImageInsertion() {
$editor->setValue('<img src="assets/example.jpg" />');
$editor->saveInto($sitetree);
- $parser = new CSSContentParser($sitetree->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.');
-
- $editor->setValue('<img src="assets/example.jpg" alt="foo" title="bar" />');
- $editor->saveInto($sitetree);
-
- $parser = new CSSContentParser($sitetree->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.');
+ $parser = new CSSContentParser($sitetree->Content);
+ $xml = $parser->getByXpath('//img');
+ $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($sitetree);
+
+ $parser = new CSSContentParser($sitetree->Content);
+ $xml = $parser->getByXpath('//img');
+ $this->assertEquals('foo', (string)$xml[0]['alt'], 'Alt tags are preserved.');
+ $this->assertEquals('bar', (string)$xml[0]['title'], 'Title tags are preserved.');
}
public function testImageTracking() {

0 comments on commit 894d487

Please sign in to comment.