php - Laravel 5.1 PHPunit error when testing urls with method call or visit -
i'm trying test controllers , routes on laravel 5.1 phpunit.
i got error:
.php fatal error: class 'pagocheque' not found
this because on views instanciate object pagocheque.
i have 2 questions:
can test controllers o routes without calling views?
if can't how can instanciate objects view needs instanciate work.
my code is:
class usertest extends testcase { use withoutmiddleware; /** * basic test example. * * @return void */ public function testexample() { $this->asserttrue(true); } public function testlistadomenu(){ $this->visit('/listpagocheques') ->see('listado'); } public function testurl(){ $response = $this->call('get', '/'); $this->assertequals(200, $response->status()); } }
hope can give directions.
thanks in advance.
updated:
class controller:
public function listpagocheques() { $input = request::all(); return view('cheques.listpagocheques')->with('cheques',$cheques) ->with('nro_recibo',$nro_recibo); }
view :
@extends('app') @section('content') <? use app\domain\pagocheque; ?> <!--div class="row"> <div class="col-lg-12"> <h3 class="page-header"></h3> </div> <!-- /.col-lg-12 --> <!--/div--> <ul class="breadcrumb"> <li>pago cheques</li> <li class="active">listado pago cursos</li> </ul> <div class="panel-body"> <div class="table-responsive"> <table class="table table-responsive table-striped table-bordered table-hover" id="cheque"> <thead> <tr> <th>nro recibo</th> <th>nro disposición fija fecha</th> <th>nro disposición pago</th> <th>nro. memo</th> <th>monto solicitado</th> <th>actividad</th> <th>subgrupo</th> <th>beneficiario</th> <th>disponible</th> <th>importe cheque</th> <th>entregado</th> <th></th> </tr> </thead> <tbody> @foreach ($cheques $cheque) <tr> <td> {{ $cheque->nro_recibo }} </td> <td> {{ $cheque->nro_disp_otorga }} </td> <td> {{ $cheque->nro_disp_aprueba }} </td> <td> {{ $pago_cheque::getnromemobyid($cheque->nro_memo_id) }} </td> <td> $ {{ $cheque->importe}} </td> <td> {{ $pago_cheque::getnombrecursobyid($cheque->curso_id)}}</td> <td> {{ $pago_cheque::getnombresubgrupobyid($cheque->curso_id)}}</td> <td> {{ $pago_cheque::getnombredocentebyid($cheque->docente_id)}}</td> <td> {{ $pago_cheque::getdisponiblechequebyid($cheque->disponible_id) }}</td> <td> $ {{ $cheque->importe_cheque}} </td> <td> {{ $pago_cheque::getentregadochequebyid($cheque->entregado_por_id) }}</td> <td> <a href="{!! url::action('chequescontroller@editcursopagocheque',$cheque->pago_cheque_id); !!}">ver</a></td> </tr> @endforeach </tbody> </table>
Comments
Post a Comment