New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem resolving paths with codeception.yml inside test root directory #4432

Closed
marcovtwout opened this Issue Aug 2, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@marcovtwout
Contributor

marcovtwout commented Aug 2, 2017

Summary

When codeception.yml is inside the test root directory, there is a problem with resolving paths to test files.

I have my folder structure set up like this:

/tests/codeception.yml
/tests/unit/ExampleTest.php

And in codeception.yml I have the path set up like this:

paths:
    tests: .

Next, I am trying to run the following command:

/tests$ codecept unit/ExampleTest.php

But this results in the following error:

 [RuntimeException]
  Suite 'unit/ExampleTest.php' could not be found

If I prepend ./ and run it like this, it works fine:

/tests$ codecept ./unit/ExampleTest.php

Full Details

/tests$ codecept run unit/ExampleTest.php -vvv
Codeception PHP Testing Framework v2.3.4
Powered by PHPUnit 5.7.21 by Sebastian Bergmann and contributors.


  [RuntimeException]
  Suite 'unit/ExampleTest.php' could not be found


Exception trace:
 () at .....\vendor\codeception\codeception\src\Codeception\Command\Run.php:356
 Codeception\Command\Run->execute() at ....\vendor\symfony\console\Command\Command.php:266
 Symfony\Component\Console\Command\Command->run() at ....\vendor\symfony\console\Application.php:861
 Symfony\Component\Console\Application->doRunCommand() at ....\vendor\symfony\console\Application.php:208
 Symfony\Component\Console\Application->doRun() at ....\vendor\symfony\console\Application.php:127
 Symfony\Component\Console\Application->run() at ....\vendor\codeception\codeception\src\Codeception\Application.php:103
 Codeception\Application->run() at ....\vendor\codeception\codeception\codecept:36
  • Codeception version: 2.3.4
  • PHP Version: 5.6
  • Operating System: Windows
  • Installation type: Composer
  • Suite configuration:
paths:
    tests: .
    output: _output
    data: _data
    support: _support
settings:
    bootstrap: _bootstrap.php
...

The problem should probably be fixed around here: https://github.com/Codeception/Codeception/blob/2.3/src/Codeception/Command/Run.php#L327

marcovtwout added a commit to marcovtwout/Codeception that referenced this issue Nov 8, 2017

Fixes Codeception#4432
Apply a workaround to fix Codeception#4432.

This allows having codeception.yml inside the tests directory by setting `paths`: `tests: .`

Fixing this issue properly requires a lot more work. The current CodeCeption implementation uses only basic string matching and does not expect "empty" tests path in multiple places. See for example Run->matchTestFromFilename() and Configuration::isEmpty()

This was referenced Nov 8, 2017

DavertMik added a commit that referenced this issue Nov 21, 2017

Fixes #4432 (#4609)
* Fixes #4432

Apply a workaround to fix #4432.

This allows having codeception.yml inside the tests directory by setting `paths`: `tests: .`

Fixing this issue properly requires a lot more work. The current CodeCeption implementation uses only basic string matching and does not expect "empty" tests path in multiple places. See for example Run->matchTestFromFilename() and Configuration::isEmpty()

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