Esempio n. 1
0
 /**
  * Test sorting laps by sector
  */
 public function testSortingLapsBySector()
 {
     // Init laps
     $laps = array();
     $lap = new Lap();
     $lap->setSectorTimes(array(100.2));
     $laps[] = $lap;
     $lap = new Lap();
     $lap->setSectorTimes(array(100.1));
     $laps[] = $lap;
     $lap = new Lap();
     $lap->setSectorTimes(array(103.5));
     $laps[] = $lap;
     // Sort laps
     $laps = Helper::sortLapsBySector($laps, 1);
     // Get sector info
     $sectors1 = $laps[0]->getSectorTimes();
     $sectors2 = $laps[1]->getSectorTimes();
     $sectors3 = $laps[2]->getSectorTimes();
     // Validate laps
     $this->assertSame(100.1, $sectors1[0]);
     $this->assertSame(100.2, $sectors2[0]);
     $this->assertSame(103.5, $sectors3[0]);
 }