Skip to content

Commit e768739

Browse files
committed
Added php doc export test
1 parent 359a332 commit e768739

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

tests/Feature/ExportPostmanTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,25 @@ public function test_event_export_works()
266266
}
267267
}
268268

269+
public function test_php_doc_comment_export()
270+
{
271+
config([
272+
'api-postman.include_doc_comments' => true,
273+
]);
274+
275+
$this->artisan('export:postman')->assertExitCode(0);
276+
277+
$this->assertTrue(true);
278+
279+
$collection = collect(json_decode(Storage::get('postman/'.config('api-postman.filename')), true)['item']);
280+
281+
$targetRequest = $collection
282+
->where('name', 'example/phpDocRoute')
283+
->first();
284+
285+
$this->assertEquals($targetRequest['request']['description'], 'This is the php doc route. Which is also multi-line. and has a blank line.');
286+
}
287+
269288
public static function providerFormDataEnabled(): array
270289
{
271290
return [

tests/Fixtures/ExampleController.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,18 @@ public function getWithFormRequest(ExampleFormRequest $request): string
4040
{
4141
return 'getWithFormRequest';
4242
}
43+
44+
/**
45+
* This is the php doc route.
46+
* Which is also multi-line.
47+
*
48+
* and has a blank line.
49+
*
50+
* @param string $non-existing param
51+
* @return string
52+
*/
53+
public function phpDocRoute(): string
54+
{
55+
return 'phpDocRoute';
56+
}
4357
}

tests/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ protected function defineRoutes($router)
2121
$router->get('showWithReflectionMethod', [ExampleController::class, 'showWithReflectionMethod'])->name('show-with-reflection-method');
2222
$router->post('storeWithFormRequest', [ExampleController::class, 'storeWithFormRequest'])->name('store-with-form-request');
2323
$router->get('getWithFormRequest', [ExampleController::class, 'getWithFormRequest'])->name('get-with-form-request');
24+
$router->get('phpDocRoute', [ExampleController::class, 'phpDocRoute'])->name('php-doc-route');
2425
});
2526
}
2627
}

0 commit comments

Comments
 (0)