Ing. Michal Hudak
Ing. Michal Hudak

Reputation: 5612

PhpStorm via phpunit.phar - Warning: require_once(PHPUnit/Runner/Version.php)

  1. I have downloaded phpunit.phar from official website https://phar.phpunit.de/phpunit.phar v4.6

PhpStorm v8.0.3 (PS-139.1348, February 12, 2015)

  1. Configured phpunit settings in PhpStorm. Set "Path to phpunit.phar".

config

  1. I created simplest unittest to test if it is working and run test in PhpStorm

<?php

class MyTest extends PHPUnit_Framework_TestCase
{
    public function testOneEqualsOne()
    {
        $this->assertEquals(1, 1);
    }
}

?>

Configured unit test to run in PhpStorm

set unit test

And run test in PhpStorm

test

I got error:

Warning: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in C:\Users\Mike\AppData\Local\Temp\ide-phpunit.php on line 49

Call Stack:
    0.0000     372768   1. {main}() C:\Users\Mike\AppData\Local\Temp\ide-phpunit.php:0
    0.0000     373120   2. IDE_PHPUnit_Loader::init() C:\Users\Mike\AppData\Local\Temp\ide-phpunit.php:209
    0.0120     630736   3. IDE_PHPUnit_Loader::detectPHPUnitVersionId() C:\Users\Mike\AppData\Local\Temp\ide-phpunit.php:196


Fatal error: require_once(): Failed opening required 'PHPUnit/Runner/Version.php' (include_path='.;C:\wamp\bin\php\php5.5.12\pear') in C:\Users\Mike\AppData\Local\Temp\ide-phpunit.php on line 49

Call Stack:
    0.0000     372768   1. {main}() C:\Users\Mike\AppData\Local\Temp\ide-phpunit.php:0
    0.0000     373120   2. IDE_PHPUnit_Loader::init() C:\Users\Mike\AppData\Local\Temp\ide-phpunit.php:209
    0.0120     630736   3. IDE_PHPUnit_Loader::detectPHPUnitVersionId() C:\Users\Mike\AppData\Local\Temp\ide-phpunit.php:196


Process finished with exit code 255

When I run test via CMD, everything is ok.

cmd

Question: How to setup PhpUnit via phpunit.phar to get it work?

Upvotes: 1

Views: 2425

Answers (1)

Ing. Michal Hudak
Ing. Michal Hudak

Reputation: 5612

PhpStorm v8 does not support PHAR version of PHPUnit 4.6.

Solution:

  • Use phpunit.phar version 4.5
  • Use PhpStorm v9 EAP builds
  • Try and hack PHPUnit support in PhpStorm a bit (detail here)

Upvotes: 2

Related Questions