sebastianbergmann/version

Incorrect Runner_Version::id() when installed via composer inside project git directory

ruudk opened this issue · 6 comments

I've PHPUnit 4.3.1 installed using Composer.

$version = new SebastianBergmann\Version('4.3.1', dirname(dirname(__DIR__)));

The problem is that this returns legacy-version-7-belgium-1829-gd13dcc3 instead of the tagged release. When looking at the code it becomes clear that whenever a .git directory is found (recursively) it will always return a git based hash as version.

But the .git directory that is found is the one of my own project (the project root). There is no .git directory inside vendor/phpunit/...

Is there a way to stop this or to limit the level of recursiveness?

@sebastianbergmann Do you have any idea how I can help to fix this? The problem is that PHPStorm reads out the PHPUnit version and says this one is not supported.

Even when I install PHPUnit globally the problem exists whenever I extend from \PHPUnit_Framework_TestCase

I cannot reproduce this:

$ git clone https://github.com/sebastianbergmann/de-legacy-fy.git
$ cd de-legacy-fy
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install
$ ./vendor/bin/phpunit --version
PHPUnit 4.3.4 by Sebastian Bergmann.

That's correct. Whenever I run phpunit --version I get the version number as well..

But when I start to run tests... it shows me a whole different version number.

That, too, I cannot reproduce:

$ ./vendor/bin/phpunit -c build
PHPUnit 4.3.4 by Sebastian Bergmann.

Configuration read from /tmp/de-legacy-fy/build/phpunit.xml

....

Time: 153 ms, Memory: 6.50Mb

OK (4 tests, 8 assertions)

Generating code coverage report in HTML format ... done

I can't reproduce it with your branch too :(

Problem solved:

composer update sebastian/version
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing sebastian/version (1.0.2)
  - Installing sebastian/version (1.0.3)
    Downloading: 100%    

Thanks for your help!