code-distortion / adapt

A Laravel package that builds databases for your tests, improving their speed
MIT License
24 stars 3 forks source link

Does Adapt support "--repeat=<times>"? #5

Closed carltondickson closed 1 year ago

carltondickson commented 1 year ago

Description:

Just a general question rather than an issue, does adapt support the following?

./vendor/bin/phpunit --repeat=3

When I run the test command the logs are showing the expected log, but only once. Either our setup/createsApplication

[2023-01-10 21:29:09] testing.DEBUG: ADAPT: ┌── ADAPT (v0.12.2) ─────────────────────────────────────────────────────────────────────────────────────────────────────┐
[2023-01-10 21:29:09] testing.DEBUG: ADAPT: │ Preparing a database for connection "testing-connection"                                                                    
[2023-01-10 21:29:09] testing.DEBUG: ADAPT: │ For test "test-folder::testItDoesSomething"
[2023-01-10 21:29:09] testing.DEBUG: ADAPT: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

etc

Then I get an error saying a table (that we try to seed into) doesn't exist. This seeding is not actually done through config and a seeder but instead in setup.

I'll have some time to debug and step through this properly next week.

code-distortion commented 1 year ago

Hi @carltondickson. Apologies again for not seeing the issue and replying sooner!

I appreciate the detail you added to the issue.

Using --repeat=x is something that I don't normally use personally, so I hadn't come across this issue before. I'm finding that people use tests in different ways which exposes different problems.

I can reproduce the problem.

I don't think how you seed the database should be a problem.

I'll look further to find out more about what's happening here.

code-distortion commented 1 year ago

Hi @carltondickson. I've released a new version to address this problem

carltondickson commented 1 year ago

@code-distortion thanks so much, quick test and this seems to work fine now.

code-distortion commented 1 year ago

Hi @carltondickson. Something to note is that --repeat has been removed from PHPUnit 10 - https://github.com/sebastianbergmann/phpunit/issues/5174#issuecomment-1418817760

carltondickson commented 1 year ago

@code-distortion thanks for the heads up