Skip to content

Commit e93f0a0

Browse files
committed
Merge branch 'fix-auto-doc-test-case' into 'master'
#-: add methods to run documentation collecting See merge request components/laravel-swagger!23
2 parents ddaf3cf + c3f0b2e commit e93f0a0

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
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/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)