File tree 1 file changed +20
-0
lines changed 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 18
18
->replace ('TRAIT ' , 'HasFactory ' )
19
19
->name ('new-test ' )
20
20
->ext ('php ' )
21
+ ->moveStub ()
21
22
->generate ();
22
23
23
24
assertTrue ($ generate );
24
25
assertFileExists (__DIR__ . '/../App/new-test.php ' );
25
26
assertFileDoesNotExist (__DIR__ . '/../App/test.stub ' );
26
27
});
27
28
29
+ test ('generate stub successfully with all options without any moving ' , function () {
30
+ $ stub = __DIR__ . '/test.stub ' ;
31
+
32
+ $ generate = LaravelStub::from ($ stub )
33
+ ->to (__DIR__ . '/../App ' )
34
+ ->replaces ([
35
+ 'CLASS ' => 'Milwad ' ,
36
+ 'NAMESPACE ' => 'App\Models '
37
+ ])
38
+ ->replace ('TRAIT ' , 'HasFactory ' )
39
+ ->name ('new-test ' )
40
+ ->ext ('php ' )
41
+ ->generate ();
42
+
43
+ assertTrue ($ generate );
44
+ assertFileExists (__DIR__ . '/../App/new-test.php ' );
45
+ assertFileExists (__DIR__ . '/../Feature/test.stub ' );
46
+ });
47
+
28
48
test ('throw exception when stub path is invalid ' , function () {
29
49
LaravelStub::from ('test.stub ' )
30
50
->to (__DIR__ . '/../App ' )
You can’t perform that action at this time.
0 commit comments