Skip to content

Conversation

@garvinhicking
Copy link
Contributor

@garvinhicking garvinhicking commented Feb 17, 2025

This is a regression bugfix for release 5.2.0.

With #6767 the ParamsLoader was streamlined, but when previously $paramsFile was passed to the loader methods, now only $paramStorage is passed, which misses getting converted to an absolute path via codecept_absolute_path().

This patch restores utilizing $paramsFile and also uses that to emit warnings when a file cannot be loaded.

This bug caused missing file resolving, because software like TYPO3 for example executes tests from the repo directory typo3/sysext/core/Tests/codeception.yml and uses:

params:
  - parameters.yml
  - env.yml

and expects that the file is found next to the codeception.yml file in the same directory, and thus a breaking change.

Closes #6829

This is a regression bugfix for release 5.2.0.

With Codeception#6767 the ParamsLoader was streamlined, but when previously `$paramsFile` was passed to the loader methods, now only `$paramStorage` is passed, which misses getting converted to an absolute path via `codecept_absolute_path()`.

This patch restores utilizing `$paramsFile` and also uses that to emit warnings when a file cannot be loaded.

This bug caused missing file resolving, because software like TYPO3 for example executes tests from the repo directory `typo3/sysext/core/Tests/codeception.yml` and uses:

```
params:
  - parameters.yml
  - env.yml
```

and expects that the file is found next to the `codeception.yml` file in the same directory, and thus a breaking change.
grossmannmartin added a commit to shopsys/shopsys that referenced this pull request Feb 17, 2025
grossmannmartin added a commit to shopsys/shopsys that referenced this pull request Feb 17, 2025
@TavoNiievez TavoNiievez merged commit 7df4ce2 into Codeception:main Feb 20, 2025
@TavoNiievez
Copy link
Member

@garvinhicking Would there be any way to have tests for this?

We need to verify that it does not change again in the future as our CI did not notice this error.

I will release version 5.2.1 today for this and PHPUnit 12 support. Thank you very much.

@garvinhicking
Copy link
Contributor Author

Thanks for the trust in advance. :) I'll see what I can do for some tests, I haven't yet checked this out, but should be possible. Give me a day or two.

@garvinhicking
Copy link
Contributor Author

garvinhicking commented Feb 20, 2025

@TavoNiievez I tried to get the tests up and running, according to the dockerized README in tests (https://github.com/Codeception/Codeception/blob/main/tests/README.md#dockerized-testing):

git clone ...
cd tests
docker-compose build
docker-compose up -d
docker-composer run --rm codecept run cli

which just yields:

Codeception PHP Testing Framework v5.2.1 https://stand-with-ukraine.pp.ua/
[Seed] 1553456819

In Assert.php line 2286:

  Result code was 1.

  Could not open input file: /repo/codecept

Seems that /repo/ is a mount to my cwd tests but there's no codecept directory and I wonder where it could stem from. What step could I be missing?

I assume that I would add tests with some dummy codeception.yaml files plus configured params: ... files with dummy files too, and then do assertions on non/failure variants, and do that in tests/cli/GlobalCommandOptionCest.php. However I need to get the tests to actually run, and my experience with codeception is just one as a consumer right now. If you have some docs to point me to to get this up and running, I'd be more than happy to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ParamsLoader references path of extra configuration files not resolved by their absolute path

2 participants