コード例 #1
0
 public function testingRechazarFunction()
 {
     $user = \App\User::where('email', '=', '*****@*****.**')->first();
     $this->be($user);
     $sol = \App\Solicitud::find(1);
     //lo mismo que esta en el controlador
     $sol->estado = 'rechazada';
     $sol->save();
     $justificacion = DB::table('justificaciones')->where('id', 1)->first();
     //excepto estas 2 lineas
     if ($justificacion != null) {
         return $this->assertEquals(0, 1);
     }
     //exepto esto
     \App\Justificacion::create(['justificacion' => 'me caes mal', 'id' => 1]);
     $sol = \App\Solicitud::find(1);
     $estado = strcmp($sol->estado, "rechazada");
     $justif = DB::table('justificaciones')->where('id', 1)->first();
     if ($justif == NULL) {
         return $this->assertEquals(0, 1);
     }
     $retjust = strcmp($justif->justificacion, "me caes mal");
     $retjust = $retjust + $estado;
     $this->assertEquals($retjust, 0);
 }
コード例 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(CargoUpdateRequest $request, $id)
 {
     $sol = \App\Solicitud::find($id);
     $sol->estado = 'rechazada';
     $sol->save();
     \App\Justificacion::create(['justificacion' => $request['nombre_cargo'], 'id' => $id]);
     Session::flash('message', 'Solicitud Rechazada');
     return Redirect::to('/evaluar');
 }