Coder Social home page Coder Social logo

covers-validator's Introduction

Oliver's GitHub stats

Top Langs

covers-validator's People

Contributors

gbirke avatar jeroendedauw avatar jochen42 avatar legoktm avatar mattstauffer avatar oradwell avatar smoench avatar theofidry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

covers-validator's Issues

Does not fail for tests with data providers

For tests with data providers PHPUnit's PHPUnit\Util\Test::getLinesToBeCovered does not throw PHPUnit\Framework\CoverageException. Need to find an alternative way of getting it working.

Provide a PHAR

Hi, nice tool thanks for it.

Would it be possible to get a phar instead of a composer dependency? Such tools are dedicated applications and you shouldn't have to add them to your project dependency (exactly as for phpunit and any static analysis tool).

Cheers

Issues with multiple test suites

Hi, I have a phpunit.xml with multiple test suites:

    <testsuites>
        <testsuite name="Unit tests">
            <directory>../tests/unittests</directory>
        </testsuite>
        <testsuite name="Integration tests">
            <directory>../tests/integration</directory>
        </testsuite>
    </testsuites>

This results in an exception:

  [ReflectionException]
  Class Unit tests does not exist

It works fine, if I comment the second test suite away. I could not find any obvious uses of the Reflection API in your project, so I am not sure where this is coming from.

covers-validator breaks for PHPUnit 9.3-9.4

PR #33 accidentally changed the name of the class from PHPUnit\TextUI\XmlConfiguration\TestSuiteMapper to PHPUnit\TextUI\XmlConfiguration\TestSuiteMappe, breaking the program for PHPUnit 9.3 and PHPUnit 9.4

Does not fail for empty covers tags

When a test method has an empty covers tag PHPUnit fails with Trying to @cover or @use not existing class or interface "". but covers-validator does not fail.

/**
 * @covers
 */
public function testSomethingWorks()
{
    ...
}

Heavy on dependencies

Adding this as a dependency causes all this stuff to be pulled in:

  • ockcyp/covers-validator (v0.2.0)
  • phpunit/phpunit (5.0.8)
  • phpunit/php-code-coverage (3.0.1)
  • phpunit/php-file-iterator (1.4.1)
  • phpunit/php-token-stream (1.4.8)
  • phpunit/php-timer (1.0.7)
  • phpunit/phpunit-mock-objects (3.0.3)
  • phpunit/php-text-template (1.2.1)
  • phpspec/prophecy (v1.5.0)
  • phpdocumentor/reflection-docblock (2.0.4)
  • doctrine/instantiator (1.0.5)
  • symfony/yaml (v2.7.6)
  • sebastian/comparator (1.2.0)
  • sebastian/diff (1.3.0)
  • sebastian/environment (1.3.2)
  • sebastian/exporter (1.2.1)
  • sebastian/recursion-context (1.0.1)
  • sebastian/global-state (1.1.1)
  • sebastian/resource-operations (1.0.0)
  • sebastian/version (1.0.6)
  • myclabs/deep-copy (1.4.0)
  • symfony/console (v2.7.6)

That triples the packages being pulled in for a lot of my projects. Can this not be avoided?

Thanks for creating this, much appreciated :)

Raise the memory_limit

Often in standard PHP configurations the memory_limit value is set to 128M. From tests I've seen covers-validator needs more.

In my case 512M was enough, but it's perhaps worth to add more.

For example composer raises internally to 1.5GB.

I think something similar is a good addition to covers-validator.

/E: The quick fix for me is to set it from the outside:

$ php -dmemory_limit=512M -f "$(which covers-validator)"

I think not needing this on first hand would make use/integration easier. Thanks for this working tool, I tried the other one you linked and I could only report issues w/o getting it to run.

Error when @covers class<extended> and class does not exist

Hi @ockcyp.

I am getting an error, when the invalid @covers annotation has a class and the annotation is to cover parent classes as wel:

* @covers Model_OAuth2_Application<extended>

This gives the following error if the class does not exist:

     [exec]   [ErrorException]                                                                           
     [exec]   class_implements(): Class Model_OAuth2_Application does not exist and could not be loaded  
     [exec]                                                                                              
     [exec] 
     [exec] 
     [exec] validate [-c|--configuration CONFIGURATION] [--bootstrap BOOTSTRAP]

Probably something internal in PHPUnit again?

Recommended version range

Should I be using ~0.3.0, or is it safe to do ~0.3, in projects that only execute vendor/bin/covers-validator with no further arguments?

Error with PHPUnit 7.x

Even though the CI here passes with PHPUNit 7.x, in my project I get an error when I use covers-validator with 7.x instead of 6.x:

CoversValidator 0.7.0

Fatal error: Uncaught Error: Class 'PHPUnit\Util\Fileloader' not found in /app/vendor/ockcyp/covers-validator/src/Loader/FileLoader.php:16
Stack trace:
#0 /app/vendor/ockcyp/covers-validator/src/Handler/InputHandler.php(31): OckCyp\CoversValidator\Loader\FileLoader::loadFile('/app/tests/boot...')
#1 /app/vendor/ockcyp/covers-validator/src/Command/ValidateCommand.php(52): OckCyp\CoversValidator\Handler\InputHandler::handleInput(Object(Symfony\Component\Console\Input\ArgvInput))
#2 /app/vendor/symfony/console/Command/Command.php(252): OckCyp\CoversValidator\Command\ValidateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /app/vendor/symfony/console/Application.php(946): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /app/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OckCyp\CoversVal in /app/vendor/ockcyp/covers-validator/src/Loader/FileLoader.php on line 16

Boostrap file ignored

I saw your project on /r/php. Cool! We run into this issue every now and then and it would be great if we could have a fast check on the @covers annotations.

I installed your package using composer and then tried to run it with our configuration file as follows:

./vendor/bin/covers-validator -c tests/phpunit.xml.

However I does not seem to load the bootstrap file referenced the configuration XML file. Our autoloader is not included.

Our config file starts with:

<?xml version="1.0" encoding="UTF-8" ?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.4/phpunit.xsd"
         backupGlobals="false"
         backupStaticAttributes="false"
         beStrictAboutTestsThatDoNotTestAnything="true"
         bootstrap="./bootstrap.php"
         colors="true">
    <php>
    ...

Of course, this results in a class not found error, because our test cases extend from our own class (which extends from PHPUnit_Framework_TestCase).

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.