Skip to content

Commit 536879b

Browse files
authored
Fix: write bootstrap file only when missing routes API file (#731)
1 parent 3a67fdf commit 536879b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Generators/RouteGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ protected function buildRouteLine($className, $slug, $method): string
101101
protected function setupApiRouter(): void
102102
{
103103
$this->createApiRoutesFileIfMissing();
104-
$this->configureApiRoutesInAppBootstrap();
105104
}
106105

107106
protected function createApiRoutesFileIfMissing(): void
108107
{
109108
$apiPath = 'routes/api.php';
110109
if (!$this->filesystem->exists($apiPath)) {
111110
$this->filesystem->put($apiPath, $this->filesystem->stub('routes.api.stub'));
111+
$this->configureApiRoutesInAppBootstrap();
112112
}
113113
}
114114

tests/Feature/Generators/RouteGeneratorTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ public function output_does_not_create_api_routes_file_when_it_exists(): void
143143
->with('routes/api.php', $this->anything())
144144
->never();
145145

146+
$this->filesystem->expects('replaceInFile')
147+
->never();
148+
146149
$tokens = $this->blueprint->parse($this->fixture('drafts/api-routes-example.yaml'));
147150
$tree = $this->blueprint->analyze($tokens);
148151

0 commit comments

Comments
 (0)