Skip to content

Commit d948ce5

Browse files
committed
Apply fixes from StyleCI
1 parent fbf9048 commit d948ce5

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

tests/FailTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testFail()
4141
// 这里应该是与 ResponseCodeEnum 中 500 状态码对应的描述,如果没有定义则取 Symfony\Component\HttpFoundation\Response
4242
// 中标准的定义
4343
'data' => (object) [],
44-
'error' => (object)[],
44+
'error' => (object) [],
4545
]);
4646

4747
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
@@ -63,7 +63,7 @@ public function testFailWithMessage()
6363
'code' => 500,
6464
'message' => '操作失败',
6565
'data' => (object) [],
66-
'error' => (object)[],
66+
'error' => (object) [],
6767
]);
6868
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
6969
}
@@ -84,7 +84,7 @@ public function testFailWithCustomCodeAndMessage()
8484
'code' => ResponseCodeEnum::SERVICE_LOGIN_ERROR, // 预期返回指定的业务错误码
8585
'message' => ResponseCodeEnum::fromValue(ResponseCodeEnum::SERVICE_LOGIN_ERROR)->description, // 预期根据业务码取相应的错误描述
8686
'data' => (object) [],
87-
'error' => (object)[],
87+
'error' => (object) [],
8888
]);
8989
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
9090
}
@@ -109,7 +109,7 @@ public function testFailOutController()
109109
'code' => ResponseCodeEnum::SYSTEM_ERROR,
110110
'message' => ResponseCodeEnum::fromValue(ResponseCodeEnum::SYSTEM_ERROR)->description,
111111
'data' => (object) [],
112-
'error' => config('app.debug', false) ? $this->convertExceptionToArray($httpException) : (object)[],
112+
'error' => config('app.debug', false) ? $this->convertExceptionToArray($httpException) : (object) [],
113113
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
114114

115115
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());

tests/SuccessTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testSuccess()
3535
'code' => 200,
3636
'message' => ResponseCodeEnum::fromValue(200)->description,
3737
'data' => (object) [],
38-
'error' => (object)[],
38+
'error' => (object) [],
3939
]);
4040
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
4141
}
@@ -52,7 +52,7 @@ public function testCreated()
5252
'code' => 201,
5353
'message' => ResponseCodeEnum::fromValue(201)->description,
5454
'data' => (object) [],
55-
'error' => (object)[],
55+
'error' => (object) [],
5656
]);
5757
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
5858
}
@@ -69,7 +69,7 @@ public function testAccepted()
6969
'code' => 202,
7070
'message' => ResponseCodeEnum::fromValue(202)->description,
7171
'data' => (object) [],
72-
'error' => (object)[],
72+
'error' => (object) [],
7373
]);
7474
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
7575
}
@@ -86,7 +86,7 @@ public function testNoContent()
8686
'code' => 204,
8787
'message' => ResponseCodeEnum::fromValue(204)->description,
8888
'data' => (object) [],
89-
'error' => (object)[],
89+
'error' => (object) [],
9090
]);
9191

9292
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
@@ -108,7 +108,7 @@ public function testSuccessWithArrayData()
108108
'code' => 200,
109109
'message' => ResponseCodeEnum::fromValue(200)->description,
110110
'data' => $data,
111-
'error' => (object)[],
111+
'error' => (object) [],
112112
]);
113113
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
114114
}
@@ -128,7 +128,7 @@ public function testSuccessWithResourceData()
128128
'nickname' => $user->name,
129129
'email' => $user->email,
130130
],
131-
'error' => (object)[],
131+
'error' => (object) [],
132132
]);
133133

134134
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
@@ -153,7 +153,7 @@ public function testSuccessWithCollectionData()
153153
'code' => 200,
154154
'message' => ResponseCodeEnum::fromValue(200)->description,
155155
'data' => $data,
156-
'error' => (object)[],
156+
'error' => (object) [],
157157
]);
158158
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
159159
}
@@ -196,7 +196,7 @@ public function testSuccessWithPaginatedData()
196196
'code' => 200,
197197
'message' => ResponseCodeEnum::fromValue(200)->description,
198198
'data' => $data,
199-
'error' => (object)[],
199+
'error' => (object) [],
200200
]);
201201

202202
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
@@ -212,7 +212,7 @@ public function testSuccessWithMessage()
212212
'code' => 200,
213213
'message' => '成功',
214214
'data' => (object) [],
215-
'error' => (object)[],
215+
'error' => (object) [],
216216
]);
217217

218218
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());
@@ -228,7 +228,7 @@ public function testSuccessWithCustomMessageAndCode()
228228
'code' => ResponseCodeEnum::SERVICE_LOGIN_SUCCESS, // 返回自定义的业务码
229229
'message' => ResponseCodeEnum::fromValue(ResponseCodeEnum::SERVICE_LOGIN_SUCCESS)->description, // 根据业务码取多语言的业务描述
230230
'data' => (object) [],
231-
'error' => (object)[],
231+
'error' => (object) [],
232232
]);
233233

234234
$this->assertJsonStringEqualsJsonString($expectedJson, $response->getContent());

0 commit comments

Comments
 (0)