File tree Expand file tree Collapse file tree 4 files changed +47
-2
lines changed Expand file tree Collapse file tree 4 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ public function parse($content)
2222 return $ matches [1 ] . strtolower ($ matches [2 ]) . ': ' . $ matches [2 ];
2323 }, $ content );
2424
25+ $ content = preg_replace_callback ('/^(\s+)(id|timestamps(Tz)?|softDeletes(Tz)?): true$/mi ' , function ($ matches ) {
26+ return $ matches [1 ] . strtolower ($ matches [2 ]) . ': ' . $ matches [2 ];
27+ }, $ content );
28+
2529 return Yaml::parse ($ content );
2630 }
2731
Original file line number Diff line number Diff line change @@ -107,6 +107,33 @@ public function it_parses_shorthands_with_timezones()
107107 ], $ this ->subject ->parse ($ blueprint ));
108108 }
109109
110+ /**
111+ * @test
112+ */
113+ public function it_parses_longhands ()
114+ {
115+ $ blueprint = $ this ->fixture ('definitions/longhands.bp ' );
116+
117+ $ this ->assertEquals ([
118+ 'models ' => [
119+ 'Proper ' => [
120+ 'id ' => 'id ' ,
121+ 'softdeletes ' => 'softDeletes ' ,
122+ 'timestamps ' => 'timestamps ' ,
123+ ],
124+ 'Lower ' => [
125+ 'id ' => 'id ' ,
126+ 'softdeletes ' => 'softdeletes ' ,
127+ 'timestampstz ' => 'timestampstz ' ,
128+ ],
129+ 'Timezone ' => [
130+ 'softdeletestz ' => 'softdeletestz ' ,
131+ 'timestampstz ' => 'timestampsTz ' ,
132+ ],
133+ ],
134+ ], $ this ->subject ->parse ($ blueprint ));
135+ }
136+
110137 /**
111138 * @test
112139 */
@@ -221,4 +248,4 @@ public function generate_uses_registered_generators_and_returns_generated_files(
221248 'deleted ' => ['one/trashed.php ' , 'two/trashed.php ' ],
222249 ], $ this ->subject ->generate ($ tree ));
223250 }
224- }
251+ }
Original file line number Diff line number Diff line change 1+ models:
2+ Proper:
3+ id: true
4+ softDeletes: true
5+ timestamps: true
6+
7+ Lower:
8+ id: id
9+ softdeletes: true
10+ timestampstz: true
11+
12+ Timezone:
13+ softdeletestz: true
14+ timestampsTz: true
Original file line number Diff line number Diff line change 11models:
22 Comment:
33 post_id: id
4- softdeletes
4+ softdeletes
You can’t perform that action at this time.
0 commit comments