Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel middleware not being run #1680

Closed
harhoo opened this issue Jan 28, 2015 · 1 comment
Closed

Laravel middleware not being run #1680

harhoo opened this issue Jan 28, 2015 · 1 comment
Labels

Comments

@harhoo
Copy link

harhoo commented Jan 28, 2015

This may be an edge case but:

Running API tests via Codeception. All works nicely except middleware is not run.

I can enable filters using $I->haveEnabledFilters() but this doesn't run middleware.

The service provider that registers the middleware is called, but the middleware itself is not used or run. I have some reasonably complicated, potentially flaky middleware so I'd like to run tests against them.

Set up:

_bootstrap.php:

include __DIR__.'/../../vendor/autoload.php';
$unitTesting = true;
$testEnvironment = 'testing';
$app = require_once __DIR__.'/../../bootstrap/start.php';
\Codeception\Util\Autoload::registerSuffix('Page', __DIR__.DIRECTORY_SEPARATOR.'_pages');
$app->boot(); 

api.suite.yml

class_name: ApiTester
modules:
    enabled: [Laravel4, ApiHelper, PhpBrowser, REST]
    config:
      PhpBrowser:
          url: http://localhost/
      REST:
          url: http://localhost/api/

Service provider:

    public function register()
    {
        $this->app->middleware('MyApp\Service\Http\ApiRights', [$this->app]);
    }
@jotweh
Copy link

jotweh commented Feb 17, 2015

I had a similar problem and I figured out, the stacked http kernel (which adds the middleware functionality) is not being used. Solution is to update the Laravel4 Connector so that it includes the middleware (see my pull request)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants