/** * testFindList * * @return void */ public function testFindList() { $this->Model->primaryKey = 'title'; $this->Model->displayField = 'title'; $result = $this->Model->find('list'); $expected = array('ATest1' => 'ATest1', 'BTest2' => 'BTest2'); $this->assertEqual($result, $expected); return; }
/** * testRead * * @return void * @access public */ function testRead() { $result = $this->Model->read(); $expected = array(array('RssModel' => array('title' => 'ATest1', 'description' => 'ATest1', 'link' => 'http://www.test1.com', 'pubDate' => 'Tue, 7 Sep 2010 00:01:01 -0500', 'Channel' => $this->channelAppend))); $this->assertEqual($result, $expected); $result = $this->Model->read(array('title'), 2); $expected = array('RssModel' => array('title' => 'ATest2')); $this->assertEqual($result, $expected); }
public static function parse($src) { $result = array(); foreach (Tag::anyhow($src)->in("item") as $in) { $o = new self(); $o->title($in->f("title.value()")); $o->link($in->f("link.value()")); $o->description($in->f("description.value()")); $o->author($in->f("author.value()")); $o->category($in->f("category.value()")); $o->comments($in->f("comments.value()")); $o->pubDate($in->f("pubDate.value()")); $o->guid($in->f("guid.value()")); $value = $in->value(); $o->enclosure = RssEnclosure::parse($value); $o->source = RssSource::parse($src); $result[] = $o; } return $result; }