Hi!
I have php ZTS 8.2.3, codeception 5.something, c3 lts, one win10 instance and one debian lts 11 ig - ci server with jenkins lts. I have a yii2 project with these.
As for drivers I have pcov lts on the ci and xdebug on win10.
uhm. extra info:
I can't get pcov on win 10, cuz since php 7.4, microsoft doesn't really support the platform anymore, so the old sdk php builder script is not working anymore, and I couldn't figure out since how to compile it locally - pecl is dead as well, so I only got pre-built xdebug.
uhm. I didn't try xdebug on the ci server yet.
So I have a few - mb 100 - unit tests and around 500 functional tests, which are basically e2e tests. I think it shouldn't matter, but I execute the functional tests with the --shard option, which has a small modification in the project that makes the tests to use different db and mailcatcher ports.
ok, that's about it about the environment.
Now, about the issues:
on the win10 local env xdebug works fine with the unit tests and generates nice reports. When I execute the functional tests however, then I gen an error message as a response for each API calls, that looks like this:
[Response] <br />
<b>Fatal error</b>: Cannot declare class yii\BaseYii, because the name is already in use in <b>C:\xampp\htdocs\portal\api\vendor\yiisoft\yii2\BaseYii.php</b> on line <b>60</
b><br />
<br />
<b>Deprecated</b>: Creation of dynamic property SebastianBergmann\CodeCoverage\Filter::$whitelistedFiles is deprecated in <b>C:\xampp\htdocs\portal\api\c3.php</b> on line <b
>240</b><br />
<br />
<b>Deprecated</b>: Creation of dynamic property SebastianBergmann\CodeCoverage\Filter::$isFileCallsCache is deprecated in <b>C:\xampp\htdocs\portal\api\c3.php</b> on line <b
>240</b><br />
<br />
<b>Fatal error</b>: Uncaught TypeError: Cannot assign __PHP_Incomplete_Class to property SebastianBergmann\CodeCoverage\CodeCoverage::$driver of type SebastianBergmann\CodeC
overage\Driver\Driver in C:\xampp\htdocs\portal\api\c3.php:240
Stack trace:
#0 C:\xampp\htdocs\portal\api\c3.php(240): unserialize('O:43:"Sebastian...')
#1 C:\xampp\htdocs\portal\api\c3.php(410): __c3_factory('C:\\xampp\\htdocs...', true)
#2 [internal function]: {closure}()
#3 {main}
thrown in <b>C:\xampp\htdocs\portal\api\c3.php</b> on line <b>240</b><br />
This error message only appears when I use the --coverage-html option. Mb it appears with other coverage options as well, I didn't try, but what I tried is that when I don't use any coverage options both the regular test execution and the sharded test execution works fine.
during test execution, in the functional.suite.yml, I use PhpBrowser, and REST module - which depends on PhpBrowser - and the urls are set to /index-test.php
The index-test.php stars like this:
...
if (file_exists(__DIR__ . '/coverage.php')) {
require __DIR__ . '/coverage.php';
}
... here are the other autoloaders ect.
coverage.php:
if (file_exists(__DIR__ . '/../../c3.php')) {
require_once __DIR__ . '/../../c3.php';
define('MY_APP_STARTED', true);
}
ok, so that was the issue with the win10 environment.
CI environment issue that uses pcov:
unit tests are executed fine here as well, results look fancy and all.
functional tests has an issue here as well. If the tests are executed with the non shareded regular method, the execution hangs forever at the 4th tests or so - couldn't figure out yet why, most likely cuz of the background process, that can do something like that if the task that is being processed fails and cant catch the exception.
The other - the one I'm more interested in - is if the tests are executed with the shard option on the first half of the tests, then I get the following message:
In LocalServer.php line 210:
[yii\base\ErrorException (2)]
file_get_contents(http://api.takenote.ln/index-test.php/c3/report/html): Fa
iled to open stream: HTTP request failed! HTTP/1.1 404 Not Found
All the tests pass, but I don't get the coverage summary at the end like I did with the unit tests, I get this error after all the passed tests instead.
When I add the -d option, then I can also see cookie Jar codeception_codeceoverage options passing left and right, so I think something is working.
Things that could help on me:
- info on whats going on with any of the issues I mentioned
- php 8.2 compilation guide, so I see what's the new trick that is used to build it after 7.4 on win, so I can compile the pcov with it and then it's easier to debug - if I get the same error locally than on the server.
- instructions on what should be fixed/what did I mess up most likely/where should I look around first to solve any of these
ty