Exemple #1
0
 /**
  * Test getListOfVisitLabels returns array
  * of visit labels with corresponding SessionID as key
  *
  * @covers Candidate::getListOfVisitLabels
  * @return void
  */
 public function testGetListOfVisitLabels()
 {
     $this->_setUpTestDoublesForSelectCandidate();
     $selectReturns = array(array('ID' => '97', 'Visit_label' => 'V01'), array('ID' => '98', 'Visit_label' => 'V02'));
     //mock pselect from getListOfVisitLabels
     $this->_dbMock->expects($this->at(2))->method('pselect')->with($this->stringStartsWith('SELECT ID, Visit_label FROM session'), $this->arrayHasKey('Candidate'))->willReturn($selectReturns);
     $expected = array();
     foreach ($selectReturns as $oneRow) {
         $expected[$oneRow['ID']] = $oneRow['Visit_label'];
     }
     $this->_candidate->select($this->_candidateInfo['CandID']);
     $this->assertEquals($expected, $this->_candidate->getListOfVisitLabels());
 }