示例#1
0
 /**
  * Testing Control Update function
  */
 public function testUpdate()
 {
     $this->withoutMiddleware();
     $response = $this->call('POST', '/control', $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->instrument_id, $this->inputUpdateControls['instrument_id']);
     $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('control.index')->with('controls', $controls);
 }