laravel-test-assertions icon indicating copy to clipboard operation
laravel-test-assertions copied to clipboard

FR: pass array for method in `assertActionUsesMiddleware`

Open edalzell opened this issue 5 years ago • 3 comments
trafficstars

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.

edalzell avatar May 02 '20 23:05 edalzell

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

ghost avatar Oct 14 '20 01:10 ghost

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

jasonmccreary avatar Oct 14 '20 12:10 jasonmccreary

Ooofff. Completely right! My bad!

ghost avatar Oct 14 '20 15:10 ghost