1
  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?

3
  • PhpStorm v8 does not support PHAR version of PHPUnit 4.6. Possible solutions: 1) Install PHPUnit via Composer 2) Use PhpStorm v9 EAP builds (it's fixed there) 3) Try and hack PHPUnit support in PhpStorm a bit (check here for some details) Commented May 16, 2015 at 18:39
  • Possible solution, downgrade phpunit.phar to 3.7 Commented May 16, 2015 at 18:43
  • Possible solution -- downgrade to 4.5 (no need for 3.x). Commented May 16, 2015 at 18:44

1 Answer 1

2

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)
Sign up to request clarification or add additional context in comments.

1 Comment

And what about phpunit 5.0.8? PHPStorm v8 still doesn't support it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.