Closed roomm closed 3 years ago
Are you running application from the same directory? Is there any chance that it has different version of codeception/codeception installed?
Yes, the application is run from the same directory and only one version (4.1.7) is installed in the project (under vendor folder there's only a version and its 4.1.7)
There must be something unusual about your deployment.
Have you got codecept.phar in /var/www/ by any chance?
If you could get the stack trace of Uncaught Error
, it would be very useful too.
Here's the stack trace:
Symfony\Component\ErrorHandler\Error\UndefinedFunctionError:
Attempted to call function "codecept_absolute_path" from namespace "Codeception\Lib".
at /var/www/vendor/codeception/codeception/src/Codeception/Lib/ParamsLoader.php:25
at Codeception\Lib\ParamsLoader->load('.env.test')
(/var/www/vendor/codeception/codeception/src/Codeception/Configuration.php:790)
at Codeception\Configuration::prepareParams(array('namespace' => 'App\\Tests', 'bootstrap' => '_bootstrap.php', 'paths' => array('tests' => 'tests', 'output' => 'tests/_output', 'data' => 'tests/_data', 'support' => 'tests/_support', 'envs' => 'tests/_envs'), 'actor_suffix' => 'Tester', 'extensions' => array('enabled' => array('Codeception\\Extension\\RunFailed'), 'config' => array(), 'commands' => array()), 'params' => array('.env.test'), 'coverage' => array('enabled' => true, 'include' => array('src/*'), 'exclude' => array('src/Command/*', 'src/Domain/ApiObject/Segment/*', 'src/Domain/ApiObject/Restaurant/Comment.php', 'src/Domain/ApiObject/Restaurant/RestaurantMainTypes.php', 'src/Webapp/Controller/SegmentController.php', 'src/Webapp/EventSubscribers/*', 'src/Domain/Services/SegmentExportService.php', 'src/Domain/Services/SegmentService.php', 'src/Domain/Services/CreateCLISegmentService.php', 'src/Domain/Services/ConceptService.php', 'src/Domain/Services/Session/SessionObservatoryService.php', 'src/Domain/Services/MongoDb/AppCacheMongoService.php', 'src/Domain/Services/MongoDb/SegmentMongoService.php', 'src/Domain/Services/Command/*', 'src/Domain/Services/DataIntegrity/*', 'src/Domain/Services/PerformanceLogService.php', 'src/Domain/Services/RestaurantFilterService.php', 'src/Domain/Document/RestaurantDocument.php', 'src/Domain/Document/SegmentDataDocument.php', 'src/Domain/Entity/*.php~', 'src/Domain/Repository/*')), 'include' => array(), 'extends' => null, 'suites' => array(), 'modules' => array(), 'reporters' => array('xml' => 'Codeception\\PHPUnit\\Log\\JUnit', 'html' => 'Codeception\\PHPUnit\\ResultPrinter\\HTML', 'report' => 'Codeception\\PHPUnit\\ResultPrinter\\Report', 'tap' => 'PHPUnit\\Util\\Log\\TAP', 'json' => 'PHPUnit\\Util\\Log\\JSON', 'phpunit-xml' => 'Codeception\\PHPUnit\\Log\\PhpUnit'), 'groups' => array(), 'settings' => array('colors' => true, 'bootstrap' => false, 'strict_xml' => false, 'lint' => true, 'backup_globals' => true, 'log_incomplete_skipped' => false, 'report_useless_tests' => false, 'disallow_test_output' => false, 'be_strict_about_changes_to_global_state' => false, 'shuffle' => false), 'gherkin' => array()))
(/var/www/vendor/codeception/codeception/src/Codeception/Configuration.php:181)
at Codeception\Configuration::config('/var/www/codeception.yml')
(/var/www/c3.php:106)
at include('/var/www/c3.php')
(/var/www/public/index.php:26)
If I add this:
require_once __DIR__ . '/vendor/codeception/codeception/autoload.php';
to the top of the c3.php file and the error chages to:
file_get_contents(http://localhost//c3/report/clear): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
Have you made any modifications to c3.php before getting that stacktrace? Codeception\Configuration::config('/var/www/codeception.yml') shouldn't be further than line 103.
For some reason it bypassed the code which includes autoload.php
We have the same or similar issue and fixed it through
diff --git a/src/Codeception/Coverage/Subscriber/LocalServer.php b/src/Codeception/Coverage/Subscriber/LocalServer.php
index 82fc99b3ee..259d655a8b 100644
--- a/src/Codeception/Coverage/Subscriber/LocalServer.php
+++ b/src/Codeception/Coverage/Subscriber/LocalServer.php
@@ -67,18 +67,17 @@ public function beforeSuite(SuiteEvent $e)
if ($this->settings['remote_config']) {
$this->addC3AccessHeader(self::COVERAGE_HEADER_CONFIG, $this->settings['remote_config']);
- }
-
- $knock = $this->c3Request('clear');
- if ($knock === false) {
- throw new RemoteException(
- '
- CodeCoverage Error.
- Check the file "c3.php" is included in your application.
- We tried to access "/c3/report/clear" but this URI was not accessible.
- You can review actual error messages in c3tmp dir.
- '
- );
+ $knock = $this->c3Request('clear');
+ if ($knock === false) {
+ throw new RemoteException(
+ '
+ CodeCoverage Error.
+ Check the file "c3.php" is included in your application.
+ We tried to access "/c3/report/clear" but this URI was not accessible.
+ You can review actual error messages in c3tmp dir.
+ '
+ );
+ }
}
}
Seems that adding the require in C3.php and fixing /src/Codeception/Coverage/Subscriber/LocalServer.php
seems to fix the core problem, but seems that there's someting else.
Now when I run the tests with coverage:
[Facebook\WebDriver\Exception\UnableToSetCookieException] [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsICookieManager.add]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: chrome://marionette/content/cookie.js :: cookie.add :: line 209" data: no]
Code Coverage issue was fixed by #5991
What are you trying to achieve?
Trying to run this
php vendor/bin/codecept run --coverage
What do you get instead?
In apache logs:
Details