Skip to content

Commit

Permalink
fix: documentation creates only for the last test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Goodmain committed Apr 28, 2024
1 parent ff32d9b commit 2a7c925
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@
namespace RonasIT\Support\AutoDoc\Tests\PhpUnitEventSubscribers;

use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Application;
use PHPUnit\Event\Test\AfterLastTestMethodFinished;
use PHPUnit\Event\Test\AfterLastTestMethodFinishedSubscriber;
use PHPUnit\Event\Application\Finished;
use PHPUnit\Event\Application\FinishedSubscriber;
use RonasIT\Support\AutoDoc\Services\SwaggerService;

final class SwaggerSaveDocumentationSubscriber implements AfterLastTestMethodFinishedSubscriber
final class SwaggerSaveDocumentationSubscriber implements FinishedSubscriber
{
public function notify(AfterLastTestMethodFinished $event): void
public function notify(Finished $event): void
{
$this->createApplication();

app(SwaggerService::class)->saveProductionData();
}

protected function createApplication(): Application
protected function createApplication(): void
{
$app = require base_path('bootstrap/app.php');

$app->loadEnvironmentFrom('.env.testing');
$app->make(Kernel::class)->bootstrap();

return $app;
}
}
}

0 comments on commit 2a7c925

Please sign in to comment.