@@ -278,21 +278,24 @@ public function generate_uses_registered_generators_and_returns_generated_files(
278
278
279
279
/**
280
280
* @test
281
+ * @dataProvider namespacesDataProvider
281
282
*/
282
- public function relative_namespace_only_replace_first_occurrence_of_default_namespace ( )
283
+ public function relative_namespace_removes_namespace_prefix_from_reference ( $ namespace , $ expected , $ reference )
283
284
{
284
- $ string = " App\Appointments " ;
285
+ config ([ ' blueprint.namespace ' => $ namespace ]) ;
285
286
286
- $ actual = Blueprint::relativeNamespace ($ string );
287
-
288
- $ this ->assertEquals ("Appointments " , $ actual );
289
-
290
- config (['blueprint.namespace ' =>'Foo ' ]);
291
-
292
- $ string = "Foo\Appointments " ;
293
-
294
- $ actual = Blueprint::relativeNamespace ($ string );
287
+ $ this ->assertEquals ($ expected , Blueprint::relativeNamespace ($ reference ));
288
+ }
295
289
296
- $ this ->assertEquals ("Appointments " , $ actual );
290
+ public function namespacesDataProvider ()
291
+ {
292
+ return [
293
+ ['App ' , 'Models\User ' , 'App\Models\User ' ],
294
+ ['App ' , 'Models\User ' , '\App\Models\User ' ],
295
+ ['App ' , 'Some\Other\Reference ' , 'Some\Other\Reference ' ],
296
+ ['App ' , 'App\Appointments ' , 'App\App\Appointments ' ],
297
+ ['Foo ' , 'Bar ' , 'Foo\Bar ' ],
298
+ ['Foo ' , 'Foo\Bar ' , '\Foo\Foo\Bar ' ],
299
+ ];
297
300
}
298
301
}
0 commit comments