-
Notifications
You must be signed in to change notification settings - Fork 45
New subscription for phpunit #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
||
$app->loadEnvironmentFrom('.env.testing'); | ||
$app->make(Kernel::class)->bootstrap(); | ||
shell_exec('php artisan swagger:push-documentation'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the console command is just a way to save the new documentation content using driver. The core logic of documentation saving is provided by the SwaggerService.
The subscriber class is another way to trigger the documentation saving, no need to use console command here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed the swagger:push-documentation
command contains all the necessary actions to save the documentation. Whenever we want to add more actions (besides the saveProductionData
method of the SwaggerService
class) to save documentation, we just need to add them in the push-documentation
command because we call this command everywhere that we want to do the same functionality.
P.S.: I replaced it with app(SwaggerService::class)->saveProductionData();
line of code.
|
||
final class SwaggerSaveDocumentationSubscriber implements FinishedSubscriber | ||
final class SwaggerSaveDocumentationSubscriber implements ExecutionFinishedSubscriber |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
сould you please describe the difference between ExecutionFinishedSubscriber and FinishedSubscriber?
I supposed that ExecutionFinishedSubscriber should be called only once while using a parallel tests, but it seems it works the same as FinishedSubscriber
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I couldn't find any documentation about these two events in the PHPUnit docs, but I guess there was a difference in performance or something.
63a9c45
to
9f6529e
Compare
1c0fdb9
to
69a7503
Compare
5b0af06
to
bb5248c
Compare
daff349
to
e926dc5
Compare
|
Hello, everyone. The
FinishedSubscriber
will be called after every test, but theExecutionFinishedSubscriber
will be called after all tests are executed.Also, by adding this extension to the
phpunit.xml
file, this process can be done automatically, which would be great for devs who don't need to concern themselves with calling this command after every test run.Also, I updated the README file to make more complete the information described.