phpunit-testing

How to use the method setup from PHPUnit in Laravel 5.8

穿精又带淫゛_ 提交于 2020-01-30 02:44:56
问题 I used to use the method setup of PHPUnit to create a instance for my test methods. But in Laravel 5.8 I can't do it I've tried both ways, and it's works makes an instance per method how showed below. This works: <?php namespace Tests\Unit; use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\RefreshDatabase; use App\Service\MyService; class MyServiceTest extends TestCase { /** * A basic unit test example. * * @return void */ public function

How to use the method setup from PHPUnit in Laravel 5.8

点点圈 提交于 2020-01-30 02:44:07
问题 I used to use the method setup of PHPUnit to create a instance for my test methods. But in Laravel 5.8 I can't do it I've tried both ways, and it's works makes an instance per method how showed below. This works: <?php namespace Tests\Unit; use Tests\TestCase; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Foundation\Testing\RefreshDatabase; use App\Service\MyService; class MyServiceTest extends TestCase { /** * A basic unit test example. * * @return void */ public function

PHPUnit 8 installed on Windows through PHAR shows No tests are executed

巧了我就是萌 提交于 2019-12-11 08:26:50
问题 I installed PHPUnit through PHAR ( https://phpunit.de/getting-started/phpunit-8.html ) and added phpunit to my system variables in Windows 10. Now I'm trying to run a test case with phpunit on the CLI, but PHPUnit shows No tests executed! . The point is that I have 5 test methods. The class I'm trying to test is this: class Calculator { /** * @assert (0, 0) == 0 * @assert (0, 1) == 1 * @assert (1, 0) == 1 * @assert (1, 1) == 2 * @assert (1, 2) == 4 */ public function add($a, $b) { return $a +