samedi 7 octobre 2017

Laravel testing

In my Laravel package package I'm testing an api endpoint, but I always get a 404 response!?!?

Here is the file (see unsuccessfulLogin method):

http://ift.tt/2g0NW3M

$this->post('/under/check', ['code' => 1235]);

In my service provider:

http://ift.tt/2wE4u4x

  $routeConfig = [
            'namespace'  => 'LarsJanssen\UnderConstruction\Controllers',
            'prefix'     => 'under',
            'middleware' => [
                'web',
            ],
        ];
        $this->getRouter()->group($routeConfig, function ($router) {
            $router->post('check', [
                'uses' => 'CodeController@check',
                'as'   => 'underconstruction.check',
            ]);
            $router->get('construction', [
                'uses' => 'CodeController@index',
                'as'   => 'underconstruction.index',
            ]);
            $router->get('js', [
                'uses' => 'AssetController@js',
                'as'   => 'underconstruction.js',
            ]);
        });

I register these routes! And in postman it's working. So why is it not working in my test?

Aucun commentaire:

Enregistrer un commentaire