Skip to content

Commit af58b34

Browse files
authored
Merge pull request #25 from RonasIT/dpankratov/version-update
Dpankratov/version update
2 parents 5f8ac1e + e93f0a0 commit af58b34

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=7.1.0",
2020
"laravel/framework": ">=5.3.0",
21-
"minime/annotations": "2.3.1"
21+
"minime/annotations": "~3.0"
2222
},
2323
"autoload": {
2424
"psr-4": {

src/Services/SwaggerService.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,9 @@ protected function parseRequestName($request)
536536
{
537537
$explodedRequest = explode('\\', $request);
538538
$requestName = array_pop($explodedRequest);
539+
$summaryName = str_replace('Request', '', $requestName);
539540

540-
$underscoreRequestName = $this->camelCaseToUnderScore($requestName);
541+
$underscoreRequestName = $this->camelCaseToUnderScore($summaryName);
541542

542543
return preg_replace('/[_]/', ' ', $underscoreRequestName);
543544
}
@@ -589,7 +590,7 @@ public function getDocFileContent()
589590
return $data;
590591
}
591592

592-
private function camelCaseToUnderScore($input)
593+
protected function camelCaseToUnderScore($input)
593594
{
594595
preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
595596
$ret = $matches[0];
@@ -637,7 +638,7 @@ protected function replaceObjectValues($parameters)
637638
* We hope swagger developers will resolve this problem in next release of Swagger OpenAPI
638639
* */
639640

640-
private function replaceNullValues($parameters, $types, &$example)
641+
protected function replaceNullValues($parameters, $types, &$example)
641642
{
642643
foreach ($parameters as $parameter => $value) {
643644
if (is_null($value) && in_array($parameter, $types)) {
@@ -650,7 +651,7 @@ private function replaceNullValues($parameters, $types, &$example)
650651
}
651652
}
652653

653-
private function getDefaultValueByType($type)
654+
protected function getDefaultValueByType($type)
654655
{
655656
$values = [
656657
'object' => 'null',

src/Tests/AutoDocTestCaseTrait.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,29 @@
77

88
trait AutoDocTestCaseTrait
99
{
10-
protected $docService;
11-
12-
public function setUp(): void
13-
{
14-
parent::setUp();
15-
16-
$this->docService = app(SwaggerService::class);
17-
}
10+
public $docService;
1811

1912
public function createApplication()
2013
{
2114
parent::createApplication();
2215
}
2316

2417
public function tearDown(): void
18+
{
19+
$this->saveDocumentation();
20+
21+
parent::tearDown();
22+
}
23+
24+
public function saveDocumentation()
2525
{
2626
$currentTestCount = $this->getTestResultObject()->count();
2727
$allTestCount = $this->getTestResultObject()->topTestSuite()->count();
2828

2929
if (($currentTestCount == $allTestCount) && (!$this->hasFailed())) {
30-
$this->docService->saveProductionData();
30+
$docService = $this->docService ?? app(SwaggerService::class);
31+
$docService->saveProductionData();
3132
}
32-
33-
parent::tearDown();
3433
}
3534

3635
/**

0 commit comments

Comments
 (0)