jeudi 20 juillet 2017

Lumen PHPUnit validation

How to PHPUnit form validation on lumen? This is because I am receiving the following error.

BadMethodCallException: Method [validateTest] does not exist.

C:\work\test\vendor\illuminate\validation\Validator.php:3360
C:\work\test\vendor\illuminate\validation\Validator.php:517
C:\work\test\vendor\illuminate\validation\Validator.php:517
C:\work\test\vendor\illuminate\validation\Validator.php:431
C:\work\test\vendor\illuminate\validation\Validator.php:456
C:\work\test\vendor\laravel\lumen-framework\src\Routing\ProvidesConvenienceMethods.php:63
C:\work\test\app\Http\Controllers\BusinessInfoController.php:30
C:\work\test\tests\app\Http\Controllers\BusinessInfoControllerTest.php:17
C:\Users\chew\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:188
C:\Users\chew\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:118

On my controller, it error out on this line.

public function getUsers(Request $request, InfoRequest, $infoRequest)
{

    $this->validate($request, $infoRequest->ruleGetInfo());
    ....
}

While on the InfoRequest:

public function ruleGetInfo()
{
    return [
        'email' => 'required',
        'password' => 'required'
    ];
}

I'm not sure why is it looking for a validateTest method. I even tried adding it on my phpunit test file and the actual controller file itself (just to test things out) but it still gives the same error.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2tvApqk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire