public function test_delete_ok()
 {
     $oldCount = ResearcherPeer::doCount(new Criteria());
     $this->goto_edit();
     $this->b->click('delete')->isRedirected()->followRedirect()->checkResponseElement('body', '/Researchers/')->checkResponseElement('body', '!/' . $this->Researchers['r1']['name'] . '/');
     $this->b->test()->is($oldCount - 1, ResearcherPeer::doCount(new Criteria()), "Researcher count should still be one less than {$oldCount}");
 }
 public function test_create_fails()
 {
     $oldCount = ResearcherPeer::doCount(new Criteria());
     $this->b->get('/researcher/list')->checkResponseElement('body', '/Researcher/')->checkResponseElement('body', '/Name/');
     $this->b->click('Create Researcher')->checkResponseElement('body', '/Create Researcher/');
     $this->b->click('save')->checkResponseElement('body', '/Create Researcher/')->checkResponseElement('body', '/The name field cannot be left blank/');
     $this->b->click('save', array('name' => 'Kenglish'))->checkResponseElement('body', '/Create Researcher/')->checkResponseElement('body', '/The organization field cannot be left blank/');
     $this->b->test()->is($oldCount, ResearcherPeer::doCount(new Criteria()), "Researcher count should still be {$oldCount}");
 }
 public function test_create_ok()
 {
     $oldCount = ResearcherPeer::doCount(new Criteria());
     $organizations = OrganizationPeer::doSelect(new Criteria());
     $organization = $organizations[0];
     $this->b->test()->ok($organization->getId(), "Should get organization " . $organization->getId());
     $this->b->get('/researcher/list')->checkResponseElement('body', '/Researcher/')->checkResponseElement('body', '/Name/');
     $this->b->click('Create Researcher')->checkResponseElement('body', '/Create Researcher/');
     $this->b->click('save', array('name' => 'Kenglish', 'organization_id' => $organization->getId()))->isRedirected()->followRedirect()->checkResponseElement('body', '/View Researcher/')->checkResponseElement('body', '/Kenglish/');
     $this->b->test()->is($oldCount + 1, ResearcherPeer::doCount(new Criteria()), "Researcher count should still be {$oldCount}");
 }
 public function countResearchers($criteria = null, $distinct = false, $con = null)
 {
     include_once 'lib/model/om/BaseResearcherPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(ResearcherPeer::ORGANIZATION_ID, $this->getId());
     return ResearcherPeer::doCount($criteria, $distinct, $con);
 }