Overriding "@package_version @" in PHPUnit output when installing from Git repo

I added PHPUnit to the project through git submodule addfollowing the instructions in this blog post . Everything works beautifully, except that the output at the top of each performance is as follows:

PHPUnit @package_version @ Sebastian Bergman.

PEAR seems to replace this value with the version number during the installation process, which doesn’t help much since I use Git to install files.

Has anyone encountered this problem and how did you solve / work it?

+3
source share
4 answers

, , , PEAR, PHPUnit package.xml. , PHPUnit .

0

. , - @package_version @ , PEAR.

, (repo clone GitHub), .

- , PEAR.

- , sha1 , .

, .

+1

It seems like this is no longer needed. From PHPUnit 3.7.1 changelog :

The version number is now displayed when using PHPUnit from a Composer or Git installation.

+1
source

This is my workaround, and yes it is not super-clean;)

I edited my phpunit file, remember to replace it with your own paths:

#!/usr/bin/env php
<?php
while (substr(getcwd(), -3) != "Project_Folder") chdir('../');
if (in_array('--version', $argv)) {
    echo 'PHPUnit 3.6.0 by Sebastian Bergmann.';
    return;
}
// set main method
define('PHPUnit_MAIN_METHOD','PHPUnit_TextUI_Command::main');

// add phpunit to the include path
$paths = scandir('./var/lib/phpunit');
$includes = array();

foreach($paths as $path){
    if (!preg_match('/^\./', $path)){
        $includes[] = './var/lib/phpunit/' . $path;
    }
}
set_include_path(implode(PATH_SEPARATOR,$includes).PATH_SEPARATOR.get_include_path());

// set the auto loader
require 'PHPUnit/Autoload.php';
// execute
PHPUnit_TextUI_Command::main();
0
source

All Articles