jasonmccreary / laravel-test-assertions

A set of helpful assertions when testing Laravel applications.
321 stars 34 forks source link

FR: pass array for method in `assertActionUsesMiddleware` #20

Open edalzell opened 4 years ago

edalzell commented 4 years ago

I currently have this in a test:

    public function controller_uses_middleware()
    {
        $this->assertActionUsesMiddleware(SubscriptionController::class, 'store', 'auth');
        $this->assertActionUsesMiddleware(SubscriptionController::class, 'update', 'auth');
        $this->assertActionUsesMiddleware(SubscriptionController::class, 'destroy', 'auth');
    }

Would be great if I could do:

    public function controller_uses_middleware()
    {
        $this->assertActionUsesMiddleware(SubscriptionController::class, ['store, 'update', 'destroy',] 'auth');
    }

Once I get a bit more comfortable with this, I'll take a crack at a PR.

ghost commented 4 years ago

https://github.com/jasonmccreary/laravel-test-assertions/pull/3

jasonmccreary commented 4 years ago

I think this is asking for the second parameter (action) to also allow an array.

ghost commented 4 years ago

Ooofff. Completely right! My bad!