Answer the question
In order to leave comments, you need to log in
How to test a new Laravel package?
Wrote a package with a new notification channel for Laravel. I want to send to the appropriate community . But among other requirements, the package must be covered by tests. And here for me a stupor - how to do it right? Searched the Internet, found nothing; it's all about unit testing a regular application on Laravel, but it's a standalone package... In general, I don't even know which side to approach. How to write a package test? Even, corny, how to use artisan in a package?
I would be grateful for links and answers!
Answer the question
In order to leave comments, you need to log in
I found the answer to my own question.
The most basic is the settings of the phpunit.xml file. You can take the most standard from Laravel.
But here it is important to specify the directory where the tests are located. If the tests folder is at the root, then:
<testsuites>
<testsuite name="Feature">
<directory>tests</directory>
</testsuite>
</testsuites>
/src
:<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
composer update
. phpunit
, or, most likely,vendor\bin\phpunit
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question