Skip to content

Commit 56bc891

Browse files
author
杨柳
authored
Add ValidationMiddleware Test.
1 parent 976e50e commit 56bc891

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/Stub/DemoRequest.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of Hyperf.
6+
*
7+
* @link https://www.hyperf.io
8+
* @document https://doc.hyperf.io
9+
* @contact [email protected]
10+
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
11+
*/
12+
13+
namespace HyperfTest\Validation\Cases\Stub;
14+
15+
use Hyperf\Validation\Request\FormRequest;
16+
17+
class DemoRequest extends FormRequest
18+
{
19+
/**
20+
* Determine if the user is authorized to make this request.
21+
*
22+
* @return bool
23+
*/
24+
public function authorize(): bool
25+
{
26+
return true;
27+
}
28+
29+
/**
30+
* Get the validation rules that apply to the request.
31+
*
32+
* @return array
33+
*/
34+
public function rules(): array
35+
{
36+
return [
37+
'username' => 'required',
38+
'password' => 'required',
39+
];
40+
}
41+
}

0 commit comments

Comments
 (0)