tests/Unit/Controllers/UrlControllerTest.php
/**
     * @test
     * @group u-controller
     * @dataProvider customKeyValidationFailProvider
     */
@test
@group u-controller
@dataProvider customKeyValidationFailProvider
@test @group u - controller @dataProvider customKeyValidationFailProvider
public function custom_key_validation_fail($data)
    {
        factory(Url::class)->create([
            'keyword' => 'laravel',
        ]);
        $request = new Request;
        $v = Validator::make($request->all(), [
            'keyword' => [
                'max:20',
                'unique:urls',
                new StrAlphaUnderscore,
                new StrLowercase,
                new KeywordBlacklist,
            ],
        ]);
        $response = $this->post(route('home').'/validate-custom-key', [
            'keyword' => $data,
        ]);
        $response->assertJson(['errors' => $v->errors()->all()]);
    }
public function custom_key_validation_fail ( $ data ) { factory ( Url :: class ) -> create ( [ 'keyword' => 'laravel' , ] ) ; $ request = new Request ; $ v = Validator :: make ( $ request -> all ( ) , [ 'keyword' => [ 'max:20' , 'unique:urls' , new StrAlphaUnderscore , new StrLowercase , new KeywordBlacklist , ] , ] ) ; $ response = $ this -> post ( route ( 'home' ) . '/validate-custom-key' , [ 'keyword' => $ data , ] ) ; $ response -> assertJson ( [ 'errors' => $ v -> errors ( ) -> all ( ) ] ) ; }
@test
 @group u-controller
 @dataProvider customKeyValidationFailProvider
@test @group u - controller @dataProvider customKeyValidationFailProvider