/**
  * Testing Control Update function
  */
 public function testUpdate()
 {
     $response = $this->action('POST', 'ControlController@store', $this->inputUpdateControls);
     $this->assertTrue($response->isRedirection());
     $this->assertRedirectedToRoute('control.index');
     $testControl = Control::orderBy('id', 'desc')->first();
     $this->assertEquals($testControl->name, $this->inputUpdateControls['name']);
     $this->assertEquals($testControl->description, $this->inputUpdateControls['description']);
     $this->assertEquals($testControl->lot_id, $this->inputUpdateControls['lot']);
     $testControlMeasures = $testControl->controlMeasures;
     foreach ($testControlMeasures as $key => $testControlMeasure) {
         $this->assertEquals($this->inputUpdateControls['new-measures'][$key]['name'], $testControlMeasure->name);
         $this->assertEquals($this->inputUpdateControls['new-measures'][$key]['unit'], $testControlMeasure->unit);
     }
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $controls = Control::orderBy('id')->get();
     return View::make('control.index')->with('controls', $controls);
 }