Configuring PHPUnit in Zend 2.5

1

I'm trying to set up PHPUnit in Zend, but it's giving an error when I run the phpunit command on the terminal.

error:

$ phpunit PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. Run 'php composer.phar install' or define a ZF2_PATH environment variable.' in /media/candidosouza/Development/GITHUB/Learning-ZF2/03-ZF2-Avancado/module/CJSN/tests/Bootstrap.php:75

My Bootstrap class has been taken from the documentation

Bootstrap Class Documentation

My settings are on my GitHub

The error is falling on this Bootstrap class IF:

if (!$zf2Path) {
    throw new RuntimeException(
        'Unable to load ZF2. Run 'php composer.phar install' or'
        . ' define a ZF2_PATH environment variable.'
    );
}

My files are configured as in the documentation! Can anyone tell me why this error!

How do I resolve this?

Thank you !!!

    
asked by anonymous 14.08.2015 / 00:02

1 answer

1

The problem was in the path path of the file Bootstrap.php on line 69 and 70

elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) {
            $zf2Path = $vendorPath . '/zendframework/zendframework/library';

and line 85

include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';

I'm using the latest version of Zend, the 2.5, in that version the path path has changed, the folder structure has changed.

Correction of lines 69 and 70 are:

elseif (is_dir($vendorPath . '/zendframework/')) {
            $zf2Path = $vendorPath . '/zendframework/';
        }

and line 85

include $zf2Path . '/zend-loader/src/AutoloaderFactory.php';

This way PHPUnit is running perfectly

    
14.08.2015 / 03:08