Skip to content

Commit 4fc5a34

Browse files
committed
rule obj test
1 parent ef23f0a commit 4fc5a34

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/Parameters/QueryParameterGeneratorTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Mtrajano\LaravelSwagger\Tests\Parameters;
44

5+
use Illuminate\Validation\Rule;
56
use Mtrajano\LaravelSwagger\Tests\TestCase;
67
use Mtrajano\LaravelSwagger\Parameters\QueryParameterGenerator;
78

@@ -61,6 +62,23 @@ public function testEnumInQuery()
6162
], $queryParameters[0]);
6263
}
6364

65+
public function testEnumRuleObjet()
66+
{
67+
$queryParameters = $this->getQueryParameters([
68+
'account_type' => [
69+
'integer',
70+
Rule::in(1,2),
71+
'in_array:foo'
72+
],
73+
]);
74+
75+
$this->assertArraySubset([
76+
'name' => 'account_type',
77+
'type' => 'integer',
78+
'enum' => ["\"1\"","\"2\""], //using Rule::in parameters are cast to string
79+
], $queryParameters[0]);
80+
}
81+
6482
private function getQueryParameters(array $rules)
6583
{
6684
return (new QueryParameterGenerator('get', '/', $rules))->getParameters();

0 commit comments

Comments
 (0)