Skip to content

Commit f12c3f5

Browse files
committed
Use web shorthand for resource type
1 parent 96202f7 commit f12c3f5

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

src/Blueprint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function parse($content)
4141
return $matches[1].strtolower($matches[2]).': '.$matches[2];
4242
}, $content);
4343

44-
$content = preg_replace_callback('/^(\s+)resource(: true)?$/mi', function ($matches) {
45-
return $matches[1].'resource: all';
44+
$content = preg_replace_callback('/^(\s+)resource?$/mi', function ($matches) {
45+
return $matches[1].'resource: web';
4646
}, $content);
4747

4848
$content = preg_replace_callback('/^(\s+)uuid(: true)?$/mi', function ($matches) {

src/Lexers/ControllerLexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private function methodsForResource(string $type)
137137
return ['api.index', 'api.store', 'api.show', 'api.update', 'api.destroy'];
138138
}
139139

140-
if ($type === 'all') {
140+
if ($type === 'web') {
141141
return ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy'];
142142
}
143143

tests/Feature/BlueprintTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function it_parses_shorthands()
8989
],
9090
'controllers' => [
9191
'Context' => [
92-
'resource' => 'all'
92+
'resource' => 'web'
9393
]
9494
]
9595
], $this->subject->parse($blueprint));
@@ -153,11 +153,6 @@ public function it_parses_longhands()
153153
'timestampstz' => 'timestampsTz',
154154
],
155155
],
156-
'controllers' => [
157-
'Context' => [
158-
'resource' => 'all'
159-
]
160-
]
161156
], $this->subject->parse($blueprint));
162157
}
163158

@@ -253,7 +248,7 @@ public function it_parses_the_readme_example_with_different_platform_eols()
253248
],
254249
],
255250
];
256-
251+
257252
$this->assertEquals($expected, $this->subject->parse($definition_mac_eol));
258253
$this->assertEquals($expected, $this->subject->parse($definition_windows_eol));
259254
}

tests/Feature/Lexers/ControllerLexerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function it_returns_a_web_resource_controller()
113113
$tokens = [
114114
'controllers' => [
115115
'Comment' => [
116-
'resource' => 'all'
116+
'resource' => 'web'
117117
]
118118
]
119119
];

tests/fixtures/definitions/longhands.bp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,3 @@ models:
1212
Timezone:
1313
softdeletestz: true
1414
timestampsTz: true
15-
16-
controllers:
17-
Context:
18-
resource: true

0 commit comments

Comments
 (0)