Permalink
Browse files

Remove ZendTest from Composer

  • Loading branch information...
1 parent eb6f0ef commit fc69a35d9794b5e96fe6901c4a03f4b6ae2bb2ab @bakura10 bakura10 committed Jun 28, 2013
Showing with 10 additions and 16 deletions.
  1. +1 −2 composer.json
  2. +9 −14 tests/_autoload.php
View
@@ -28,8 +28,7 @@
},
"autoload": {
"psr-0": {
- "Zend\\": "library/",
- "ZendTest\\": "tests/"
+ "Zend\\": "library/"
}
},
"bin": [
View
@@ -3,17 +3,12 @@
* Setup autoloading
*/
-if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
- include_once __DIR__ . '/../vendor/autoload.php';
-} else {
- // if composer autoloader is missing, explicitly add the ZF library path
- 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();
-}
+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();

4 comments on commit fc69a35

What's the reason why the ZendTest namespace is removed? We are inheriting some ZendTest classes in our testsuite and relying on Composer autoloading.

Contributor

bakura10 replied Jul 2, 2013

Since a few release, test folder is not included when you download ZF 2 through composer (you need to explicitly add the --prefer-source option to composer so that it retrieves the tests also). However, this was problematic when you were dumping an optimized class map autoloader because Composer assumed there was a ZendTest folder, but didn't find the files, and crashed.

Owner

weierophinney replied Jul 2, 2013

@arjanvdbos -- the namespace is still present, we're simply using the StandardAutoloader in order to load that namespace. You can do similarly in your own test suite if you need to use any of our test assets -- just point the autoloader at the test directory.

@weierophinney -- I’ll understand, but the downside of this approach is that we always manually have to modify the autoloading when we add a dependency and consuming their tests. It would be nice when Composer implement a autoload-dev, which imho would be a nicer solution. See Added an autoload-dev section.

Please sign in to comment.