Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Feedback

  • Loading branch information...
commit 3bf60a31e4e3079942f437e74a523cf2bf32821e 1 parent b8126fc
@bakura10 bakura10 authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 tests/_autoload.php
View
5 tests/_autoload.php
@@ -5,12 +5,11 @@
include_once __DIR__ . '/../vendor/autoload.php';
-require_once __DIR__ . '/../library/Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader(
array(
Zend\Loader\StandardAutoloader::LOAD_NS => array(
- 'Zend' => __DIR__ . '/../library/Zend',
'ZendTest' => __DIR__ . '/ZendTest',
),
- ));
+ )
+);
$loader->register();

5 comments on commit 3bf60a3

@gerardroche

Doesn't this break autoloading without using composer? i.e. clone zf2, cd into tests dir, run phpunit ZendTest/Escaper/EscaperTest.php and you get errors:

PHP Fatal error:  Class 'Zend\Loader\StandardAutoloader' not found in /path/to/zf2/tests/_autoload.php on line 8

I had to fix it by adding back what was removed.

@weierophinney

@gerardroche We require that you run a composer.phar install in order to run unit tests. As such, the StandardAutoloader will be autoloadable, allowing us to configure it.

We went this route because it makes the following more straight-forward for contributors:

  • The PHPUnit version(s) we support will be immediately available
  • Autoloading is simpler
  • Any dependencies on 3rd party libraries are installed and autoloadable

So, no, no fix is needed -- just install the composer dependencies to ensure you have what is needed to run the tests.

@gerardroche

@weierophinney The thing is I didn't need composer or any dependencies to get what I needed done. I only needed to test one component so I reverted this change and added a file_exists for __DIR__ . '/../vendor/autoload.php' because it was spitting out a php warning about the file not existing.

Can we not have both? i.e. you can run tests without composer or dependencies but all bets are off if you do.

@weierophinney

@gerardroche No, we cannot have both, as that would mean we then have to maintain more code to allow tests to work. Right now, the situation is:

composer.phar install
cd tests
../vendor/bin/phpunit ZendTest/SomeComponent/

We do not need to worry about PHPUnit incompatibilities, autoloading issues due to include_path issues, etc. It's a single toolchain for everybody.

@gerardroche

:) cool, thanks.

Please sign in to comment.
Something went wrong with that request. Please try again.