'Custom'))); } static function findByTitle($title) { return lmbActiveRecord :: find('TestObjectTagVersion', 'title = "' . $title . '"'); } } class lmbActiveRecordFetchTagTest extends lmbWactTestCase { function setUp() { parent :: setUp(); $this->_dbCleanUp(); } function tearDown() { $this->_dbCleanUp(); parent :: tearDown(); } function _dbCleanUp() { lmbActiveRecord :: delete('TestObjectTagVersion'); } function testFetchAll() { $c1 = $this->_createObject(); $c2 = $this->_createObject(); $template = '' . '{$title}|'; $this->registerTestingTemplate('/limb/ar_fetch_all.html', $template); $page = $this->initTemplate('/limb/ar_fetch_all.html'); $this->assertEqual(trim($page->capture()), $c1->getTitle() . '|' . $c2->getTitle() . '|'); } function testFetchAllAttributeUsing() { $c1 = $this->_createObject(); $c2 = $this->_createObject(); $template = '' . '{$title}|'; $this->registerTestingTemplate('/limb/ar_fetch_all2.html', $template); $page = $this->initTemplate('/limb/ar_fetch_all2.html'); $this->assertEqual(trim($page->capture()), $c1->getTitle() . '|' . $c2->getTitle() . '|'); } function testFetchNoObject() { $template = '' . ''. ''. ''. 'id={$id}'. 'no object'. ''; $this->registerTestingTemplate('/limb/ar_fetch_noobject.html', $template); $page = $this->initTemplate('/limb/ar_fetch_noobject.html'); $this->assertEqual(trim($page->capture()), 'no object'); } function testFetchWithCustomFindMethod() { $template = '' . '{$method}'; $this->registerTestingTemplate('/limb/ar_fetch_with_custom_find.html', $template); $page = $this->initTemplate('/limb/ar_fetch_with_custom_find.html'); $this->assertEqual($page->capture(), 'Custom'); } function _createObject() { $object = new TestObjectTagVersion(); $object->setTitle('some title' . mt_rand()); $object->save(); return $object; } } ?>