Skip to content

Commit 0cab104

Browse files
committed
QFE
1 parent 266597c commit 0cab104

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

src/Console/Contracts/GeneratorCommand.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,7 @@ public function addRoute(
186186
}
187187
}
188188

189-
if (file_exists($routeFile)) {
190-
file_put_contents($routeFile, <<<'DATA'
191-
<?php
192-
193189

194-
DATA
195-
);
196-
}
197190
$routeContent = file_exists($routeFile)
198191
? file_get_contents($routeFile)
199192
: null;

tests/Feature/CrayCommandTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,7 @@ public function test_it_generates_route_names_correctly()
164164

165165
public function test_it_adds_route_for_the_controller()
166166
{
167-
if (! file_exists(base_path('routes/web.php'))) {
168-
touch(base_path('routes/web.php'));
169-
file_put_contents(base_path('routes/web.php'), "<?php\n\n");
170-
}
171-
$this->artisan('cray Models/Post --route-base=custom-route')/*->expectsQuestion('', 1)*/
172-
;
167+
$this->artisan('cray Models/Post --route-base=custom-route');
173168

174169
$this->assertStringContainsString("Route::resource('custom-route', App\\Http\\Controllers\PostController::class)",
175170
file_get_contents(base_path('routes/web.php')), 'Route not added');

tests/TestCase.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ public function removeGeneratedFiles()
8383

8484
if (file_exists(base_path('routes/web.php'))) {
8585
unlink(base_path('routes/web.php'));
86-
file_put_contents(base_path('routes/web.php'), "<?php\n\n");
86+
file_put_contents(base_path('routes/web.php'), <<<'DATA'
87+
<?php
88+
89+
Route::get('/home', function(){
90+
return 'Dummy Page';
91+
});
92+
93+
DATA
94+
);
8795
}
8896

8997
if (file_exists(app_path('Http/Controllers/PostController.php'))) {

0 commit comments

Comments
 (0)