|
1 | 1 | <?php
|
2 | 2 | namespace Vyuldashev\LaravelOpenApi\Tests\Builders;
|
3 | 3 |
|
| 4 | +use phpDocumentor\Reflection\DocBlock; |
4 | 5 | use Vyuldashev\LaravelOpenApi\Tests\TestCase;
|
5 | 6 | use GoldSpecDigital\ObjectOrientedOAS\OpenApi;
|
6 | 7 | use Vyuldashev\LaravelOpenApi\RouteInformation;
|
|
9 | 10 | use GoldSpecDigital\ObjectOrientedOAS\Objects\Components;
|
10 | 11 | use GoldSpecDigital\ObjectOrientedOAS\Objects\SecurityScheme;
|
11 | 12 | use Vyuldashev\LaravelOpenApi\Factories\SecuritySchemeFactory;
|
| 13 | +use Vyuldashev\LaravelOpenApi\Builders\Paths\OperationsBuilder; |
12 | 14 | use GoldSpecDigital\ObjectOrientedOAS\Objects\SecurityRequirement;
|
13 | 15 | use Vyuldashev\LaravelOpenApi\Builders\Paths\Operation\SecurityBuilder;
|
14 | 16 | use Vyuldashev\LaravelOpenApi\Attributes\Operation as AttributesOperation;
|
@@ -152,32 +154,32 @@ public function testWeCanAddTurnOffOperationSecurityUsingBuilder()
|
152 | 154 | ->securitySchemes($testJwtScheme);
|
153 | 155 |
|
154 | 156 | $routeInfo = new RouteInformation;
|
155 |
| - $routeInfo->action = 'get'; |
| 157 | + $routeInfo->parameters = collect(); |
| 158 | + $routeInfo->action = 'foo'; |
| 159 | + $routeInfo->method = 'get'; |
156 | 160 | $routeInfo->name = 'test route';
|
| 161 | + $routeInfo->actionDocBlock = new DocBlock('Test'); |
157 | 162 | $routeInfo->actionAttributes = collect([
|
158 | 163 | /**
|
159 |
| - * we can set secuity to null to turn it off, as |
160 |
| - * that's the default value. So '' is next best |
161 |
| - * option? |
162 |
| - */ |
| 164 | + * we can set secuity to null to turn it off, as |
| 165 | + * that's the default value. So '' is next best |
| 166 | + * option? |
| 167 | + */ |
163 | 168 | new AttributesOperation(security: ''),
|
164 | 169 | ]);
|
165 |
| - $routeInfo->uri = '/example'; |
166 | 170 |
|
167 |
| - /** @var SecurityBuilder */ |
168 |
| - $builder = resolve(SecurityBuilder::class); |
| 171 | + /** @var OperationsBuilder */ |
| 172 | + $operationsBuilder = resolve(OperationsBuilder::class); |
169 | 173 |
|
170 |
| - $operation = Operation::create() |
171 |
| - ->security(...$builder->build($routeInfo)) |
172 |
| - ->action('get'); |
| 174 | + $operations = $operationsBuilder->build([$routeInfo]); |
173 | 175 |
|
174 | 176 | $openApi = OpenApi::create()
|
175 | 177 | ->security($globalRequirement)
|
176 | 178 | ->components($components)
|
177 | 179 | ->paths(
|
178 | 180 | PathItem::create()
|
179 | 181 | ->route('/foo')
|
180 |
| - ->operations($operation) |
| 182 | + ->operations(...$operations) |
181 | 183 | );
|
182 | 184 |
|
183 | 185 | self::assertSame([
|
|
0 commit comments