Git Product home page Git Product logo

Comments (9)

sebastianbergmann avatar sebastianbergmann commented on June 30, 2024

I cannot get the tests to work on GitHub Actions: https://github.com/sebastianbergmann/phpcov/actions/runs/4136062962/jobs/7149383819

@Slamdunk @localheinz Any idea what I might be doing wrong? Thanks!

from phpcov.

localheinz avatar localheinz commented on June 30, 2024

@sebastianbergmann

The tests are failing for me locally as well.

Running

vendor/bin/phpunit --configuration=phpunit.xml

yields

PHPUnit 10.0.7 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.14
Configuration: phpunit.xml

..SSS....FF.........                                              20 / 20 (100%)

Time: 00:00.738, Memory: 6.00 MB

There were 2 failures:

1) /Users/am/Sites/sebastianbergmann/phpcov/tests/end-to-end/merge/valid-directory-with-text-report-stdout.phpt
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@

 Generating code coverage report in text format ...

-Code Coverage Report:
-  %s
-
- Summary:
-  Classes: 100.00% (1/1)
-  Methods: 100.00% (2/2)
-  Lines:   66.67% (2/3)
-
-SebastianBergmann\PHPCOV\TestFixture\Greeter
-  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  2/  2)
+Code Coverage Report:
+  2023-02-09 16:15:39
+
+ Summary:
+  Classes:        (0/0)
+  Methods:        (0/0)
+  Lines:          (0/0)

/Users/am/Sites/sebastianbergmann/phpcov/tests/end-to-end/merge/valid-directory-with-text-report-stdout.phpt:20

2) /Users/am/Sites/sebastianbergmann/phpcov/tests/end-to-end/merge/valid-directory-with-text-report.phpt
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 int(0)


-Code Coverage Report:
-  %s
-
- Summary:
-  Classes: 100.00% (1/1)
-  Methods: 100.00% (2/2)
-  Lines:   66.67% (2/3)
-
-SebastianBergmann\PHPCOV\TestFixture\Greeter
-  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  2/  2)
+Code Coverage Report:
+  2023-02-09 16:15:39
+
+ Summary:
+  Classes:        (0/0)
+  Methods:        (0/0)
+  Lines:          (0/0)

/Users/am/Sites/sebastianbergmann/phpcov/tests/end-to-end/merge/valid-directory-with-text-report.phpt:28

FAILURES!
Tests: 20, Assertions: 17, Failures: 2, Skipped: 3.

from phpcov.

sebastianbergmann avatar sebastianbergmann commented on June 30, 2024

They work for me locally:

$ XDEBUG_MODE=coverage php -d pcov.enabled=0 vendor/bin/phpunit  
PHPUnit 10.0-dev by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.2
Configuration: /usr/local/src/phpcov/phpunit.xml

S.................SS                                              20 / 20 (100%)

Time: 00:01.268, Memory: 6.00 MB

OK, but some tests were skipped!
Tests: 20, Assertions: 17, Skipped: 3.

from phpcov.

Slamdunk avatar Slamdunk commented on June 30, 2024

The reason why the suite fails with PCOV is in its readme:

When pcov.directory is left unset, PCOV will attempt to find src, lib or app in the current working directory, in that order; If none are found the current directory will be used, which may waste resources storing coverage information for the test suite.

There is a src dir, so tests gets excluded. If you manually set tests as the collection directory, it works again with PCOV too:

$ php -d pcov.enabled=1 -d pcov.directory=tests vendor/bin/phpunit 
PHPUnit 10.0.7 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.2
Configuration: /usr/local/src/phpcov/phpunit.xml

....................                                              20 / 20 (100%)

Time: 00:00.783, Memory: 6.00 MB

OK (20 tests, 20 assertions)

I also bet this is the reason the update-fixture target didn't work when you run it @sebastianbergmann

from phpcov.

sebastianbergmann avatar sebastianbergmann commented on June 30, 2024

We configure the setup-php action to set up Xdebug for code coverage, not PCOV (https://github.com/sebastianbergmann/phpcov/blob/main/.github/workflows/ci.yml#L73).

PHPUnit prints that it is using Xdebug, not PCOV (https://github.com/sebastianbergmann/phpcov/actions/runs/4136354441/jobs/7150093791#step:5:11).

I am confused :-/

from phpcov.

Slamdunk avatar Slamdunk commented on June 30, 2024

That's another issue: tests/fixture/example/coverage/*.cov files have /usr/local/src/phpcov/[...] as the hardcoded path for the produced coverage data.
Indeed to get the test pass I had to move the project under /usr/local/src on my local PC.

I guess the only way is to recreate fixtures before each test run, so it can be easily managed both locally and on CI

from phpcov.

sebastianbergmann avatar sebastianbergmann commented on June 30, 2024

You are absolutely right!

from phpcov.

sebastianbergmann avatar sebastianbergmann commented on June 30, 2024

After 337d169 I now run into https://github.com/sebastianbergmann/phpcov/actions/runs/4141720052/jobs/7161596636#step:7:35 because of https://github.com/sebastianbergmann/phpcov/blob/main/tests/end-to-end/patch-coverage/valid-arguments-with-valid-path-prefix.phpt#L11.

Now we "just" need to make $_SERVER['argv'][3] = '/usr/local/src/phpcov'; dynamic.

from phpcov.

sebastianbergmann avatar sebastianbergmann commented on June 30, 2024

Now we "just" need to make $_SERVER['argv'][3] = '/usr/local/src/phpcov'; dynamic.

Et voilà: 166b95b

from phpcov.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.