function testCmp()
 {
     $n1 = Notebook_Page::getOneFromDb(['notebook_page_id' => 1101], $this->DB);
     $n2 = Notebook_Page::getOneFromDb(['notebook_page_id' => 1102], $this->DB);
     //            util_prePrintR($n1);
     //            util_prePrintR($n2);
     $this->assertEqual(Notebook_Page::cmp($n1, $n2), -1);
     $this->assertEqual(Notebook_Page::cmp($n1, $n1), 0);
     $this->assertEqual(Notebook_Page::cmp($n2, $n1), 1);
     $nps = Notebook_Page::getAllFromDb([], $this->DB);
     usort($nps, 'Notebook_Page::cmp');
     $this->assertEqual(1101, $nps[0]->notebook_page_id);
     $this->assertEqual(1102, $nps[1]->notebook_page_id);
     $this->assertEqual(1103, $nps[2]->notebook_page_id);
     $this->assertEqual(1104, $nps[3]->notebook_page_id);
 }
 public function loadNotebookPages()
 {
     $this->notebook_pages = Notebook_Page::getAllFromDb(['authoritative_plant_id' => $this->authoritative_plant_id, 'flag_delete' => FALSE], $this->dbConnection);
     usort($this->notebook_pages, 'Notebook_Page::cmp');
 }
 public function loadPages()
 {
     $this->pages = Notebook_Page::getAllFromDb(['notebook_id' => $this->notebook_id], $this->dbConnection);
     usort($this->pages, 'Notebook_Page::cmp');
 }
 function testRelatedDataListing()
 {
     $u = User::getOneFromDb(['user_id' => 101], $this->DB);
     $pages = Notebook_Page::getAllFromDb(['notebook_id' => 1001], $this->DB);
     $this->doLoginBasic();
     $this->get('http://localhost/digitalfieldnotebooks/app_code/notebook.php?action=edit&notebook_id=1001');
     $this->checkBasicAsserts();
     //        $this->todo('owner name has link to user page');
     $this->assertLink(htmlentities($u->screen_name));
     //        $this->todo('notebook pages are listed and linked');
     $this->assertLink($pages[0]->getAuthoritativePlant()->renderAsShortText());
     $this->assertLink($pages[1]->getAuthoritativePlant()->renderAsShortText());
     //        util_prePrintR(htmlentities($this->getBrowser()->getContent()));
 }