0

As a tester, I want security and reliability by using PHPUnit to test my code.

Presently, PHPUnit only passes the first of eleven tests. It then abandons the remaining tests, with no message.

>>>  vendor/bin/phpunit [path to my test]
<<<  .

[No message from PHPUnit after the first '.'.]

What I've tried:

  • Removing PHPUnit, clearing my cache (composer clearcache), and reinstalling PHPUnit (composer install)
  • Making sure each test docstring has @test in it
  • Using \test[a-zA-Z]\ as function names
  • Using phpunit --filter [name of a test that didn't run]
  • Changing PHPUnit from v8.4.3 to v8.2 (composer update)
  • Adding dd("Hi") to the first, second, and third tests. (It shows up with #1 and #2, but not #3)

What I've read:

  • (Stuff with the same search terms but a different problem) this, this, this.
  • The most helpful I've read is this.
  • Also other pages.

My test suite.

My phpunit.xml file

My specs:

  • Laravel 6.5.6
  • PHPUnit 8.4.3

How do I make PHPUnit run all eleven tests?

Any help is appreciated.

1 Answers1

0

Why did the tests not run? I don't know.

But I do know how I got them to run again:

  • Delete the whole working directory

My team uses Docker. Something about Docker tracks the original directory. Even if you delete it and put a new directory there with the same name, it appears it's linked to the actual folder and not the location. So putting a new folder in the same spot with the same name doesn't work. So I need to restart the Docker thing.

  • Stop all the Docker processes: docker kill $(docker ps -q)
  • Remove all containers: docker rm $(docker ps -a -q)

Get the original stuff back up. These steps are standard in Laravel apps.

  • Clone the directory from BitBucket/GitHub/etc.
  • In the directory, run docker-compose build && docker-compose up -d
  • composer install
  • npm i
  • php artisan migrate
  • php artisan db:seed