vendredi 1 juillet 2016

PhpStorm debug unit tests hangs

I am running PhpStorm. Building up a new PHP project and just trying to integrate PHPUnit. The tests run and pass just fine. PhpStorm records the results without issue. However, when I try to debug the unit tests, PhpStorm seems to hang at 'Instantiating tests...'

I can debug my application code just fine with xdebug and the built-in php web server through PhpStorm.

So, what's wrong with the unit test debugging? Anybody know how to fix it? Thanks for the help!

Versions:
PhpStorm 2016.1.2
PHPUnit 5.4.6
PHP 7.0.4
Ubuntu 16.04
XDebug 2.4.0

PhpStorm is referencing PHPUnit by the phpunit.phar setup on my system.

Unit Test Code:

<?php

require '../../vendor/autoload.php';

use UtilitiesArrayCollection;


class ArrayCollectionTest extends PHPUnit_Framework_TestCase
{
    public function testToArraySingleDepth() {
        $arr = new ArrayCollection();

        $arr->offsetSet('item 1', 'value 1');
        $arr->offsetSet('item 2', 'value 2');

        $simple = $arr->toArray();

        $this->assertEquals(2, count($simple), 'Count does not match.');
        $this->assertEquals('value 1', $simple['item 1'], 'Missing value 1');
        $this->assertEquals('value 2', $simple['item 2'], 'Missing value 2');
    }

    public function testToArrayNested() {
        $arr = new ArrayCollection();

        $arr->offsetSet('item 1', ['nest 1' => 'nested value 1']);
        $arr->offsetSet('item 2', ['nest 2' => ['subnest 1' => 'subnest 1']]);

        $simple = $arr->toArray();

        $this->assertEquals(2, count($simple), 'Shallow count failed');
        $this->assertEquals(5, count($simple, COUNT_RECURSIVE), 'Deep count failed');
        $this->assertEquals('subnest 1', $simple['item 2']['nest 2']['subnest 1']);
    }
}

Aucun commentaire:

Enregistrer un commentaire