public function testGetAllMappings()
 {
     $expected_row = (object) array('id' => 123, 'uid' => $uid, 'jobid' => $jobid, 'start_time' => NULL, 'end_time' => NULL);
     $expected_mapping = new TZUserJobMapping($expected_row);
     $expected_mapping->setDBWrapper($this->dbWrapper);
     $expected_cursor = new stdClass();
     $this->dbWrapper->expects($this->once())->method('query')->with('SELECT * FROM {tzusers_tzjobs} ORDER BY id')->will($this->returnValue($expected_cursor));
     $this->dbWrapper->expects($this->exactly(2))->method('fetchObject')->with($expected_cursor)->will($this->onConsecutiveCalls($expected_row, NULL));
     $mappings = $this->mapper->findAll();
     $this->assertEquals(1, count($mappings));
     $this->assertEquals($expected_mapping, $mappings[0]);
 }
 function testBeginTimeInsideIntervalAllowsReportCreation()
 {
     $expected_begintime = 1308829978;
     // 2011-06-23 12:36:18 +0200
     $expected_record = array('uid' => $this->expected_uid, 'jobid' => $this->expected_jobid, 'start_time' => 1308825379, 'end_time' => 1308829978);
     $mapping = new TZUserJobMapping($expected_record);
     $may_create_report = $mapping->mayCreateReport($this->expected_uid, $this->expected_jobid, $expected_begintime);
     $this->assertTrue($may_create_report);
 }