1
- < ?hh // partial
1
+ < ?hh // strict
2
2
3
3
namespace Slack\Hack\JsonSchema\Tests ;
4
4
5
5
use namespace HH\Lib\C ;
6
6
use function Facebook\FBExpect\expect ;
7
7
8
- use type Slack\Hack\JsonSchema\Tests\Generated\{
9
- AddressSchemaFileValidator ,
10
- AddressSchemaValidator ,
11
- };
8
+ use type Slack\Hack\JsonSchema\Tests\Generated\{AddressSchemaFileValidator , AddressSchemaValidator} ;
12
9
13
10
final class AddressSchemaValidatorTest extends BaseCodegenTestCase {
14
11
15
12
<<__Override >>
16
13
public static async function beforeFirstTestAsync (): Awaitable <void > {
17
14
$ret = self :: getBuilder(' address-schema.json' , ' AddressSchemaValidator' );
18
15
$ret [' codegen' ]-> build();
19
- $ret_remote = self :: getBuilder(
20
- ' address-schema-remote.json' ,
21
- ' AddressSchemaFileValidator' ,
22
- );
16
+ $ret_remote = self :: getBuilder(' address-schema-remote.json' , ' AddressSchemaFileValidator' );
23
17
$ret_remote [' codegen' ]-> build();
24
18
require_once ($ret [' path' ]);
25
19
require_once ($ret_remote [' path' ]);
@@ -63,9 +57,7 @@ public function testAddressWithNumericPostalCode(): void {
63
57
]);
64
58
$validator -> validate();
65
59
66
- expect ($validator -> isValid())-> toBeTrue(
67
- ' numeric postal codes should be valid' ,
68
- );
60
+ expect ($validator -> isValid())-> toBeTrue(' numeric postal codes should be valid' );
69
61
}
70
62
71
63
public function testAddressWithInvalidPostalCode (): void {
@@ -93,9 +85,7 @@ public function testAddressWithFileRef(): void {
93
85
]);
94
86
$validator -> validate();
95
87
96
- expect ($validator -> isValid())-> toBeTrue(
97
- ' file reference to phone type should be valid' ,
98
- );
88
+ expect ($validator -> isValid())-> toBeTrue(' file reference to phone type should be valid' );
99
89
}
100
90
101
91
public function testAddressWithSizeAllOf (): void {
@@ -106,9 +96,7 @@ public function testAddressWithSizeAllOf(): void {
106
96
' size' => 200 ,
107
97
]);
108
98
$validator -> validate();
109
- expect ($validator -> isValid())-> toBeTrue(
110
- ' should be valid as 200 is both an integer and a number' ,
111
- );
99
+ expect ($validator -> isValid())-> toBeTrue(' should be valid as 200 is both an integer and a number' );
112
100
}
113
101
114
102
public function testAddressWithSizeAllOfFailure (): void {
@@ -119,9 +107,7 @@ public function testAddressWithSizeAllOfFailure(): void {
119
107
' size' => 200.5 ,
120
108
]);
121
109
$validator -> validate();
122
- expect ($validator -> isValid())-> toBeFalse(
123
- ' should not be valid as 200.5 is not an integer' ,
124
- );
110
+ expect ($validator -> isValid())-> toBeFalse(' should not be valid as 200.5 is not an integer' );
125
111
}
126
112
127
113
public function testAddressWithLongitudeNot (): void {
@@ -132,9 +118,7 @@ public function testAddressWithLongitudeNot(): void {
132
118
' longitude' => 200.5 ,
133
119
]);
134
120
$validator -> validate();
135
- expect ($validator -> isValid())-> toBeTrue(
136
- ' should be valid as 200.5 is not an integer nor a string' ,
137
- );
121
+ expect ($validator -> isValid())-> toBeTrue(' should be valid as 200.5 is not an integer nor a string' );
138
122
}
139
123
140
124
public function testAddressWithLongitudeNotFailure (): void {
@@ -145,9 +129,7 @@ public function testAddressWithLongitudeNotFailure(): void {
145
129
' longitude' => 200 ,
146
130
]);
147
131
$validator -> validate();
148
- expect ($validator -> isValid())-> toBeFalse(
149
- ' should not be valid as 200 is an integer' ,
150
- );
132
+ expect ($validator -> isValid())-> toBeFalse(' should not be valid as 200 is an integer' );
151
133
}
152
134
153
135
public function testAddressWithLatitudeOneOf (): void {
@@ -158,9 +140,7 @@ public function testAddressWithLatitudeOneOf(): void {
158
140
' latitude' => 200.5 ,
159
141
]);
160
142
$validator -> validate();
161
- expect ($validator -> isValid())-> toBeTrue(
162
- ' should be valid as 200.5 is not an integer but is a number' ,
163
- );
143
+ expect ($validator -> isValid())-> toBeTrue(' should be valid as 200.5 is not an integer but is a number' );
164
144
}
165
145
166
146
public function testAddressWithLatitudeOneOfFailure (): void {
@@ -171,9 +151,7 @@ public function testAddressWithLatitudeOneOfFailure(): void {
171
151
' latitude' => 200 ,
172
152
]);
173
153
$validator -> validate();
174
- expect ($validator -> isValid())-> toBeFalse(
175
- ' should not be valid as 200 is an integer and number' ,
176
- );
154
+ expect ($validator -> isValid())-> toBeFalse(' should not be valid as 200 is an integer and number' );
177
155
}
178
156
179
157
public function testAddressWithFailedFileRef (): void {
@@ -188,9 +166,7 @@ public function testAddressWithFailedFileRef(): void {
188
166
],
189
167
]);
190
168
$validator -> validate();
191
- expect ($validator -> isValid())-> toBeFalse(
192
- ' file reference to phone type should be invalid' ,
193
- );
169
+ expect ($validator -> isValid())-> toBeFalse(' file reference to phone type should be invalid' );
194
170
expect (C \count ($validator -> getErrors()))-> toBeSame(3 );
195
171
}
196
172
@@ -209,9 +185,7 @@ public function testAddressWithDifferentFileRef(): void {
209
185
]);
210
186
$validator -> validate();
211
187
212
- expect ($validator -> isValid())-> toBeTrue(
213
- ' file reference to phone type should be valid' ,
214
- );
188
+ expect ($validator -> isValid())-> toBeTrue(' file reference to phone type should be valid' );
215
189
}
216
190
217
191
public function testAddressWithFalseDepthRefs (): void {
@@ -229,9 +203,7 @@ public function testAddressWithFalseDepthRefs(): void {
229
203
]);
230
204
$validator -> validate();
231
205
232
- expect ($validator -> isValid())-> toBeFalse(
233
- ' file reference to phone type should be valid' ,
234
- );
206
+ expect ($validator -> isValid())-> toBeFalse(' file reference to phone type should be valid' );
235
207
expect (C \count ($validator -> getErrors()))-> toBeSame(2 );
236
208
}
237
209
0 commit comments