Skip to content

Commit

Permalink
MSS-151: Add test for file subbrand appending to DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberwolf committed May 5, 2015
1 parent 3c37d3d commit b06b40f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/CultureFeed/Cdb/Data/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,31 @@ public function testAppendsTitleElementContainingTitle()

$this->assertEquals($title, $items->item(0)->textContent);
}

public function testAppendsSubBrand()
{
$subBrand = '2b88e17a-27fc-4310-9556-4df7188a051f';
$this->file->setSubBrand($subBrand);

$xpath = $this->xpathOnMediaWithFileAppended($this->file);
$items = $xpath->query('/media/file/subbrand');
$this->assertEquals(1, $items->length);

$this->assertEquals($subBrand, $items->item(0)->textContent);
}

/**
* @return DOMXPath
*/
private function xpathOnMediaWithFileAppended(CultureFeed_Cdb_Data_File $file)
{
$dom = new DOMDocument();
$mediaElement = $dom->createElement('media');
$dom->appendChild($mediaElement);

$file->appendToDOM($mediaElement);

return new DOMXPath($dom);
}

}

0 comments on commit b06b40f

Please sign in to comment.