Beispiel #1
0
 public function testGetFeedOnItemWithFile()
 {
     $filename = 'test.jpg';
     $mimeType = 'image/jpeg';
     $size = '1024';
     // Dispatching seems to be required to get the view scripts loaded
     $this->dispatch('items/browse');
     $item = new Item();
     $item->id = 100;
     // Some sneaky stuff here to trick ItemAtom into seeing a file for
     // an item without saving them.
     $file = new File();
     $file->id = 100;
     $file->filename = $filename;
     $file->mime_type = $mimeType;
     $file->size = $size;
     $item->Files = array($file);
     $atom = new Output_ItemAtom(array($item));
     $feed = $atom->getFeed();
     $dom = new Zend_Dom_Query($feed);
     $this->_assertAtomFeed($dom);
     $href = $file->getWebPath('original');
     $queryResult = $dom->queryXpath("/atom:feed/atom:entry/atom:link[@rel='enclosure' and @type='{$mimeType}' and @length='{$size}' and @href='{$href}']");
     $this->assertCount(1, $queryResult, 'The feed did not contain a correct file enclosure.');
 }
Beispiel #2
0
<?php

$atom = new Output_ItemAtom($items);
echo $atom->getFeed();