2017 © Pedro Peláez
 

library covers-validator

Validates @covers tags in PHPUnit tests

image

ockcyp/covers-validator

Validates @covers tags in PHPUnit tests

  • Wednesday, May 9, 2018
  • by ockcyp
  • Repository
  • 1 Watchers
  • 10 Stars
  • 40,375 Installations
  • PHP
  • 56 Dependents
  • 0 Suggesters
  • 3 Forks
  • 4 Open issues
  • 17 Versions
  • 8 % Grown

The README.md

ockcyp/covers-validator

Build Status Coverage Status Scrutinizer Code Quality License Total Downloads, (*1)

PHPUnit @covers tags validator, (*2)

PHPUnit fails to generate coverage report when tests have invalid @covers tags., (*3)

This tool allows you to determine the tests that have invalid @covers tags without you needing to run the coverage., (*4)

Usually coverage reports are run less often than the tests as it takes a long time to run. This tool validates your @covers tags quicker than you run your tests., (*5)

Also see: dunkelfrosch/phpcoverfish, (*6)

Why?

Trying to @cover or @use not existing class or interface "NonExistentClass".
Trying to @cover or @use not existing method "ExistingClass::nonExistantMethod".

See: phpunit/issues/1758
Also see: phpunit/issues/1791, (*7)

Installation

composer require --dev ockcyp/covers-validator

PHPUnit versions

Latest version of covers-validator supports PHP 7.1+ and PHPUnit 7+. Please use version 0.5 for older PHP and PHPUnit versions., (*8)

PHPUnit version Covers-validator version
< 6.0 0.5.x
>= 6.0 1.x

Install using the following for version 0.5:, (*9)

composer require --dev ockcyp/covers-validator "^0.5"

Usage

vendor/bin/covers-validator

Give optional -c argument to load a particular PHPUnit configuration file:, (*10)

vendor/bin/covers-validator -c tests/Fixtures/configuration.xml

Override bootstrap specified in PHPUnit configuration:, (*11)

vendor/bin/covers-validator --bootstrap tests/bootstrap.php

Disable output by providing -q argument, (*12)

vendor/bin/covers-validator -q

Adjust the verbosity:, (*13)

Verbosity Shows
-v Valid tests
-vv Loaded configuration file
-vvv Test name before validation is done

Sample output

Normal verbosity

Invalid - OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringNonExistentClassTest::testDummyTest

There were 1 test(s) with invalid @covers tags.

Maximum verbosity (debug)

Configuration file loaded: /home/omer/Projects/Personal/covers-validator/tests/Fixtures/configuration-all.xml

Validating OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringExistingClassTest::testDummyTest...
Valid - OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringExistingClassTest::testDummyTest
Validating OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringNonExistentClassTest::testDummyTest...
Invalid - OckCyp\CoversValidator\Tests\Fixtures\TwoTestCoveringNonExistentClassTest::testDummyTest

There were 1 test(s) with invalid @covers tags.

Tip: Command gives exit code 1 when any of the covers tags are invalid. Use this to fail your builds., (*14)

Tests

To run the tests, execute:, (*15)

vendor/bin/phpunit

The Versions

09/05 2018

dev-master

9999999-dev

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

09/05 2018

0.5.x-dev

0.5.9999999.9999999-dev

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

09/05 2018

v1.0.0

1.0.0.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

09/05 2018

v0.5.2

0.5.2.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

08/05 2018

dev-patch-1

dev-patch-1

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

08/05 2018

dev-patch-15-19

dev-patch-15-19

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

08/05 2018

v0.7.2

0.7.2.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

23/04 2018

v0.7.1

0.7.1.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

04/04 2018

v0.7.0

0.7.0.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

24/04 2017

v0.5.1

0.5.1.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

24/04 2017

v0.6.1

0.6.1.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

08/02 2017

v0.6.0

0.6.0.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

14/12 2016

v0.5.0

0.5.0.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Oliver Radwell

23/11 2015

v0.4.0

0.4.0.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Omer Karadagli

05/11 2015

v0.3.0

0.3.0.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Omer Karadagli

29/10 2015

v0.2.0

0.2.0.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Omer Karadagli

28/10 2015

v0.1.0

0.1.0.0

Validates @covers tags in PHPUnit tests

  Sources   Download

MIT

The Requires

 

by Omer Karadagli