Example #1
0
 public function testCreate()
 {
     $vehicle = new Vehicle();
     $vehicle->setMPG(25);
     $vehicle->setUser(new User());
     $vehicle->setMake(new Make());
     $this->assertSame(25, $vehicle->getMPG());
     $this->assertTrue($vehicle->getUser() instanceof User);
     $this->assertTrue($vehicle->getMake() instanceof Make);
 }
 protected function generateReportForVehicle(Vehicle $vehicle, $options = array())
 {
     $username = $vehicle->getUser()->getUsername();
     $vehicle_slug = $vehicle->getSlug();
     $from = $this->getFrom($options);
     $to = $this->getTo($options);
     $name = $vehicle->getName() . ' - from ' . $from . ' to ' . $to;
     $arguments = array('username' => $username, 'vehicles' => $vehicle_slug, 'name' => '"' . $name . '"');
     $options = array('date_from' => isset($options['date_from']) ? $options['date_from'] : null, 'date_to' => isset($options['date_to']) ? $options['date_to'] : null, 'kilometers_from' => isset($options['kilometers_from']) ? $options['kilometers_from'] : null, 'kilometers_to' => isset($options['kilometers_to']) ? $options['kilometers_to'] : null);
     try {
         $this->runTask('otokou:generateReportPdf', $arguments, $options);
         $this->log('ok: report written.');
     } catch (Exception $exc) {
         $this->log('not ok: no charges found');
     }
 }