allure-framework / allure-framework/allure-phpunit

Allure PHPUnit extension is not recognising the parameter path if the phpunit.xml.dist is placed in a different directory than root.

Open
#106 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
66
Forks
34
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
If phpunit.xml.dist file is placed in a different path other than root. Then in CLI, if I am running below command from project root:

`./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist`

It is giving below error:

```
There was 1 PHPUnit test runner warning:

1) Bootstrapping of extension Qameta\Allure\PHPUnit\AllureExtension failed: Config file allure/allure.config.php doesn't exist
#0 /opt/homebrew/var/www/project/vendor/allure-framework/allure-phpunit/src/AllureExtension.php(39): Qameta\Allure\PHPUnit\AllureExtension->loadConfigData('allure/allure.c...')
#1 /opt/homebrew/var/www/project/vendor/allure-framework/allure-phpunit/src/AllureExtension.php(99): Qameta\Allure\PHPUnit\AllureExtension->createTestLifecycle('allure/allure.c...')
#2 /opt/homebrew/var/www/project/vendor/phpunit/phpunit/src/Runner/Extension/ExtensionBootstrapper.php(73): Qameta\Allure\PHPUnit\AllureExtension->bootstrap(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\Extension\Facade), Object(PHPUnit\Runner\Extension\ParameterCollection))
#3 /opt/homebrew/var/www/project/vendor/phpunit/phpunit/src/TextUI/Application.php(418): PHPUnit\Runner\Extension\ExtensionBootstrapper->bootstrap('Qameta\\Allure\\P...', Array)
#4 /opt/homebrew/var/www/project/vendor/phpunit/phpunit/src/TextUI/Application.php(131): PHPUnit\TextUI\Application->bootstrapExtensions(Object(PHPUnit\TextUI\Configuration\Configuration))
#5 /opt/homebrew/var/www/project/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#6 /opt/homebrew/var/www/project/vendor/bin/phpunit(122): include('/opt/homebrew/v...')
#7 {main}
```

**To Reproduce**
Steps to reproduce the behavior:
1. Create a directory project-root/dev/tests/unit/phpunit.xml.dist and keep configurations in same.
2. The phpunit.xml.dist config could be something like below:
```






```

Directory structure is something like:
Screenshot 2024-10-08 at 1 10 04 PM

**Expected behavior**
It was supposed to work smoothly with all configurations getting used properly and allure reports to be generated.

**Actual behavior**
Getting error as described in description and no allure reports are getting generated. AllureExtension is not taking absolute path as it should be. This behaviour was working correctly with PHPUnit 9 config file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.