Giter VIP home page Giter VIP logo

task-phpunit's People

Contributors

mrook avatar siad007 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

task-phpunit's Issues

PHPUnitTask pharlocation should be removed in phing-3.0.0-RC3.phar release

Describe the bug
I have been trying to set up a phpunit task in my build.xml. I have had been trying to use the pharlocation attribute as documented here: https://www.phing.info/guide/chunkhtml/PHPUnitTask.html. But my tests are never ran.

I've downloded the phing-3.0.0-RC3.phar from the releases github page. After extracting that, directly invoking it, and debugging through the code, it seems that the 3.0.0 phar has its own bundled phpunit. So when the pharlocation attribute is set on the phpunit task, it blows up (silently) since phpunit is already loaded. I changed this block of code to see the issue:

Original:

private function loadPHPUnit()
    {
        if (!empty($this->pharLocation)) {
            $GLOBALS['_SERVER']['SCRIPT_NAME'] = '-';
            ob_start();
            @include $this->pharLocation;
            ob_end_clean();
        }

Changed to show errors:

private function loadPHPUnit()
    {
        if (!empty($this->pharLocation)) {
            $GLOBALS['_SERVER']['SCRIPT_NAME'] = '-';
            //ob_start();
            include $this->pharLocation;
            //ob_end_clean();
        }

Steps To Reproduce
Create a simple build.xml file to run phpunit tests:

    <target name="test" description="runs phpunit unit tests" depends="set.props.main.test,enforce.build.dirs,genautoload">
        <echo msg="${phpunit.location}" />
        <echo msg="buildDir: ${build.dir}" />
        <phpunit bootstrap="${build.dir}/bootstraptests.php" pharLocation="${phpunit.location}" printsummary="true" haltonfailure="true" haltonerror="true">
            <formatter type="plain" usefile="false"/>
            <batchtest>
                <fileset dir="${build.dir}">
                    <include name="**/*Test.php"/>
                </fileset>
            </batchtest>
        </phpunit>
    </target>

Expected behavior
PHPUnit test cases are run.

Screenshots / terminal output
This is the output after making my above changes to see the errors:

     [echo] /home/pi/files/utils/php/phpunit.phar
     [echo] buildDir: /var/www/html/checkHookPlugin/build-test
#!/usr/bin/env php
PHP Fatal error:  Cannot declare class PHPUnit\Framework\Constraint\Constraint, because the name is already in use in phar:///home/pi/files/utils/php/phpunit.phar/phpunit/Framework/Constraint/Constraint.php on line 23

Additional context
After removing the pharlocation attribute in my build.xml, the tests run as expected.

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.