Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit not working in PHPStorm

I have the following test file, an example on PHPUnit's website.

<?php

require_once 'PHPUnit/Autoload.php';

class StackTest extends PHPUnit_Framework_TestCase
{
    public function testPushAndPop()
    {
        $stack = array();
        $this->assertEquals(0, count($stack));

        array_push($stack, 'foo');
        $this->assertEquals('foo', $stack[count($stack)-1]);
        $this->assertEquals(1, count($stack));

        $this->assertEquals('foo', array_pop($stack));
        $this->assertEquals(0, count($stack));
    }
}
?>

I am trying to run it in PHPStorm 5.0, but I get the following error:

E:\wamp\bin\php\php5.3.13\php.exe C:\Users\<user>\AppData\Local\Temp\ide-phpunit.php --no-configuration StackTest E:\wamp\www\renting\tests\StackTest.php
Testing started at 03:37 ...

SCREAM:  Error suppression ignored for
Warning: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in C:\Users\<user>\AppData\Local\Temp\ide-phpunit.php on line 166

Any ideas why it is going to C: when I have set the include path to E: ?

like image 824
cgf Avatar asked Mar 02 '13 03:03

cgf


People also ask

Can not find PHPUnit library to install use PHP composer Phar install?

First go to Settings -> Languages and Frameworks -> PHP and Add a remote interpreter, then go to Settings -> Languages and Frameworks -> PHP -> PHPUnit click the + on top and click by Remote Interpreter . If you're using Composer autoloader, then enter your full Vagrant path to your autoloader file.


2 Answers

Solved it!

It seems that there was a problem with some dependency, specifically pear.symfony.com/Yaml.

Solved it by doing:

pear channel-discover pear.symfony.com
pear install pear.symfony.com/Yaml
pear channel-discover pear.phpunit.de
pear install --alldeps pear.phpunit.de/PHPUnit

The idea for the solution came from: How do I correctly install PHPUnit with PEAR?

like image 155
cgf Avatar answered Sep 21 '22 23:09

cgf


I struggled with a similair issue for a quite while, that turned out to be a rights issue.

Here is my solution: https://stackoverflow.com/a/22886926/1311443

Hope that it can help other people solve similair issues faster.

like image 41
Michael Valentin Avatar answered Sep 21 '22 23:09

Michael Valentin