classes/phing/tasks/ext/phpunit/PHPUnitTask.php
protected function handlePHPUnitConfiguration(PhingFile $configuration)
    {
        if (!$configuration->exists()) {
            throw new BuildException("Unable to find PHPUnit configuration file '" . (string) $configuration . "'");
        }

        if (class_exists('PHPUnit_Util_Configuration')) {
            $config = PHPUnit_Util_Configuration::getInstance($configuration->getAbsolutePath());
        } else {
            $config = \PHPUnit\Util\Configuration::getInstance($configuration->getAbsolutePath());
        }

        if (empty($config)) {
            return;
        }

        $phpunit = $config->getPHPUnitConfiguration();

        if (empty($phpunit)) {
            return;
        }

        $config->handlePHPConfiguration();

        if (isset($phpunit['bootstrap'])) {
            $this->setBootstrap($phpunit['bootstrap']);
        }

        if (isset($phpunit['stopOnFailure'])) {
            $this->setHaltonfailure($phpunit['stopOnFailure']);
        }

        if (isset($phpunit['stopOnError'])) {
            $this->setHaltonerror($phpunit['stopOnError']);
        }

        if (isset($phpunit['stopOnSkipped'])) {
            $this->setHaltonskipped($phpunit['stopOnSkipped']);
        }

        if (isset($phpunit['stopOnIncomplete'])) {
            $this->setHaltonincomplete($phpunit['stopOnIncomplete']);
        }

        if (isset($phpunit['processIsolation'])) {
            $this->setProcessIsolation($phpunit['processIsolation']);
        }

        foreach ($config->getListenerConfiguration() as $listener) {
            if (!class_exists($listener['class'], false)
                && $listener['file'] !== ''
            ) {
                include_once $listener['file'];
            }

            if (class_exists($listener['class'])) {
                if (count($listener['arguments']) == 0) {
                    $listener = new $listener['class'];
                } else {
                    $listenerClass = new ReflectionClass(
                        $listener['class']
                    );
                    $listener = $listenerClass->newInstanceArgs(
                        $listener['arguments']
                    );
                }

                if ($listener instanceof \PHPUnit\Framework\TestListener) {
                    $this->addListener($listener);
                }
            }
        }

        if (method_exists($config, 'getSeleniumBrowserConfiguration')) {
            $browsers = $config->getSeleniumBrowserConfiguration();

            if (!empty($browsers)
                && class_exists('PHPUnit_Extensions_SeleniumTestCase')
            ) {
                PHPUnit_Extensions_SeleniumTestCase::$browsers = $browsers;
            }
        }

        return $phpunit;
    }
protected function handlePHPUnitConfiguration(PhingFile $configuration)
    {
        if (!$configuration->exists()) {
            throw new BuildException("Unable to find PHPUnit configuration file '" . (string) $configuration . "'");
        }

        if (class_exists('PHPUnit_Util_Configuration')) {
            $config = PHPUnit_Util_Configuration::getInstance($configuration->getAbsolutePath());
        } else {
            $config = \PHPUnit\Util\Configuration::getInstance($configuration->getAbsolutePath());
        }

        if (empty($config)) {
            return;
        }

        $phpunit = $config->getPHPUnitConfiguration();

        if (empty($phpunit)) {
            return;
        }

        $config->handlePHPConfiguration();

        if (isset($phpunit['bootstrap'])) {
            $this->setBootstrap($phpunit['bootstrap']);
        }

        if (isset($phpunit['stopOnFailure'])) {
            $this->setHaltonfailure($phpunit['stopOnFailure']);
        }

        if (isset($phpunit['stopOnError'])) {
            $this->setHaltonerror($phpunit['stopOnError']);
        }

        if (isset($phpunit['stopOnSkipped'])) {
            $this->setHaltonskipped($phpunit['stopOnSkipped']);
        }

        if (isset($phpunit['stopOnIncomplete'])) {
            $this->setHaltonincomplete($phpunit['stopOnIncomplete']);
        }

        if (isset($phpunit['processIsolation'])) {
            $this->setProcessIsolation($phpunit['processIsolation']);
        }

        foreach ($config->getListenerConfiguration() as $listener) {
            if (!class_exists($listener['class'], false)
                && $listener['file'] !== ''
            ) {
                include_once $listener['file'];
            }

            if (class_exists($listener['class'])) {
                if (count($listener['arguments']) == 0) {
                    $listener = new $listener['class'];
                } else {
                    $listenerClass = new ReflectionClass(
                        $listener['class']
                    );
                    $listener = $listenerClass->newInstanceArgs(
                        $listener['arguments']
                    );
                }

                if ($listener instanceof \PHPUnit\Framework\TestListener) {
                    $this->addListener($listener);
                }
            }
        }

        if (method_exists($config, 'getSeleniumBrowserConfiguration')) {
            $browsers = $config->getSeleniumBrowserConfiguration();

            if (!empty($browsers)
                && class_exists('PHPUnit_Extensions_SeleniumTestCase')
            ) {
                PHPUnit_Extensions_SeleniumTestCase::$browsers = $browsers;
            }
        }

        return $phpunit;
    }
protected function handlePHPUnitConfiguration ( PhingFile $ configuration ) { if ( ! $ configuration -> exists ( ) ) { throw new BuildException ( "Unable to find PHPUnit configuration file '" . ( string ) $ configuration . "'" ) ; } if ( class_exists ( 'PHPUnit_Util_Configuration' ) ) { $ config = PHPUnit_Util_Configuration :: getInstance ( $ configuration -> getAbsolutePath ( ) ) ; } else { $ config = \ PHPUnit \ Util \ Configuration :: getInstance ( $ configuration -> getAbsolutePath ( ) ) ; } if ( empty ( $ config ) ) { return ; } $ phpunit = $ config -> getPHPUnitConfiguration ( ) ; if ( empty ( $ phpunit ) ) { return ; } $ config -> handlePHPConfiguration ( ) ; if ( isset ( $ phpunit [ 'bootstrap' ] ) ) { $ this -> setBootstrap ( $ phpunit [ 'bootstrap' ] ) ; } if ( isset ( $ phpunit [ 'stopOnFailure' ] ) ) { $ this -> setHaltonfailure ( $ phpunit [ 'stopOnFailure' ] ) ; } if ( isset ( $ phpunit [ 'stopOnError' ] ) ) { $ this -> setHaltonerror ( $ phpunit [ 'stopOnError' ] ) ; } if ( isset ( $ phpunit [ 'stopOnSkipped' ] ) ) { $ this -> setHaltonskipped ( $ phpunit [ 'stopOnSkipped' ] ) ; } if ( isset ( $ phpunit [ 'stopOnIncomplete' ] ) ) { $ this -> setHaltonincomplete ( $ phpunit [ 'stopOnIncomplete' ] ) ; } if ( isset ( $ phpunit [ 'processIsolation' ] ) ) { $ this -> setProcessIsolation ( $ phpunit [ 'processIsolation' ] ) ; } foreach ( $ config -> getListenerConfiguration ( ) as $ listener ) { if ( ! class_exists ( $ listener [ 'class' ] , false ) && $ listener [ 'file' ] !== '' ) { include_once $ listener [ 'file' ] ; } if ( class_exists ( $ listener [ 'class' ] ) ) { if ( count ( $ listener [ 'arguments' ] ) == 0 ) { $ listener = new $ listener [ 'class' ] ; } else { $ listenerClass = new ReflectionClass ( $ listener [ 'class' ] ) ; $ listener = $ listenerClass -> newInstanceArgs ( $ listener [ 'arguments' ] ) ; } if ( $ listener instanceof \ PHPUnit \ Framework \ TestListener ) { $ this -> addListener ( $ listener ) ; } } } if ( method_exists ( $ config , 'getSeleniumBrowserConfiguration' ) ) { $ browsers = $ config -> getSeleniumBrowserConfiguration ( ) ; if ( ! empty ( $ browsers ) && class_exists ( 'PHPUnit_Extensions_SeleniumTestCase' ) ) { PHPUnit_Extensions_SeleniumTestCase :: $ browsers = $ browsers ; } } return $ phpunit ; }
Load and processes the PHPUnit configuration

@param  $configuration
@throws BuildException
@return array
Load and processes the PHPUnit configuration