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)
22
22
return $ matches [1 ] . strtolower ($ matches [2 ]) . ': ' . $ matches [2 ];
23
23
}, $ content );
24
24
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
+
25
29
return Yaml::parse ($ content );
26
30
}
27
31
Original file line number Diff line number Diff line change @@ -107,6 +107,33 @@ public function it_parses_shorthands_with_timezones()
107
107
], $ this ->subject ->parse ($ blueprint ));
108
108
}
109
109
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
+
110
137
/**
111
138
* @test
112
139
*/
@@ -221,4 +248,4 @@ public function generate_uses_registered_generators_and_returns_generated_files(
221
248
'deleted ' => ['one/trashed.php ' , 'two/trashed.php ' ],
222
249
], $ this ->subject ->generate ($ tree ));
223
250
}
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 1
1
models:
2
2
Comment:
3
3
post_id: id
4
- softdeletes
4
+ softdeletes
You can’t perform that action at this time.
0 commit comments