orchestral/testbench

phpunit.xml Env Variables Not Loaded in `testbench package:test` Command

Closed this issue · 4 comments

  • Testbench Version: 8.11
  • PHP Version: 8.1

Description:

when running ./vendor/bin/phpunit directly all tests work correctly, but when testing with the command ./vendor/bin/testbench package:test it shows No application encryption key has been specified.

This occurs when the encrypt function is used

Screenshot 2023-09-22 at 04 04 13

I tried dd($_ENV) in testing, it seems the ./vendor/bin/testbench package:test command doesn't load the env defined in phpunit.xml

  1. ./vendor/bin/phpunit
Screenshot 2023-09-22 at 04 05 43
  1. ./vendor/bin/testbench package:test
Screenshot 2023-09-22 at 04 05 56

Steps To Reproduce:

  1. git clone https://github.com/SupianIDz/testbench-test
  2. composer install
  3. ./vendor/bin/phpunit
  4. ./vendor/bin/testbench package:test

orchestral/testbench-core@5cc96a4

Unable to reproduce, our GitHub Action also being tested using package:test and package:test --parallel without issue.

Hi @crynobone

could you take a look reproduction of the repository? I tried in 3 different environments + github action but got the same error.

github action workflow : https://github.com/SupianIDz/testbench-test/blob/main/.github/workflows/testbench.yml
github action result : https://github.com/SupianIDz/testbench-test/actions/runs/6271550982/job/17031352888

Screenshot 2023-09-22 at 15 47 40
  1. result from linux server
Screenshot 2023-09-22 at 15 31 50
  1. result from ubuntu desktop
    Screenshot from 2023-09-22 15-28-32

could you take a look reproduction of the repository? I tried in 3 different environments + github action but got the same error.

You can try submit a failing test to https://github.com/orchestral/testbench-core

I think this is enough: orchestral/testbench-core@b9fc730

but I am very confused about this problem, it can be seen from the reproduction of the repo, everything is very minimal but the error still occurs.

https://github.com/SupianIDz/testbench-test/blob/main/tests/FooBarTest.php#L14