Permalink
Browse files

[zen-60] Specify doctrine/common dependency

- Added doctrine/common dependency to composer.json
- Updated travis configuration to ensure dependencies from composer are
  installed before running tests (suggested by ocramius)
- Modified test autoloader to use composer + StandardAutoloader
  • Loading branch information...
1 parent 4f5263e commit fb4d3797954e24dd4635aa3901ae4a9969eee240 @weierophinney weierophinney committed Jun 28, 2012
Showing with 19 additions and 52 deletions.
  1. +3 −1 .travis.yml
  2. +2 −1 composer.json
  3. +9 −50 tests/_autoload.php
  4. +5 −0 vendor/.gitignore
View
@@ -7,9 +7,11 @@ php:
before_install:
- cp tests/TestConfiguration.php.travis tests/TestConfiguration.php
+ - curl -s http://getcomposer.org/installer | php
+ - php composer.phar install
script:
- php ./tests/run-tests.php
notifications:
- irc: "irc.freenode.org#zftalk.2"
+ irc: "irc.freenode.org#zftalk.2"
View
@@ -9,7 +9,8 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
- "php": ">=5.3.3"
+ "php": ">=5.3.3",
+ "doctrine/common": ">=2.1"
},
"autoload": {
"psr-0": {
View
@@ -2,55 +2,14 @@
/**
* Setup autoloading
*/
-function ZendTest_Autoloader($class)
-{
- $class = ltrim($class, '\\');
-
- if (!preg_match('#^(Zend(Test)?|PHPUnit)(\\\\|_)#', $class)) {
- return false;
- }
-
- // $segments = explode('\\', $class); // preg_split('#\\\\|_#', $class);//
- $segments = preg_split('#[\\\\_]#', $class); // preg_split('#\\\\|_#', $class);//
- $ns = array_shift($segments);
-
- switch ($ns) {
- case 'Zend':
- $file = dirname(__DIR__) . '/library/Zend/';
- break;
- case 'ZendTest':
- // temporary fix for ZendTest namespace until we can migrate files
- // into ZendTest dir
- $file = __DIR__ . '/Zend/';
- break;
- default:
- $file = false;
- break;
- }
-
- if ($file) {
- $file .= implode('/', $segments) . '.php';
- if (file_exists($file)) {
- return include_once $file;
- }
- }
-
- $segments = explode('_', $class);
- $ns = array_shift($segments);
-
- switch ($ns) {
- case 'Zend':
- $file = dirname(__DIR__) . '/library/Zend/';
- break;
- default:
- return false;
- }
- $file .= implode('/', $segments) . '.php';
- if (file_exists($file)) {
- return include_once $file;
- }
-
- return false;
+if (!include_once __DIR__ . '/../vendor/autoload.php') {
+ throw new UnexpectedValueException('Could not find composer; did you run `php composer.phar install`?');
}
-spl_autoload_register('ZendTest_Autoloader', true, true);
+$loader = new Zend\Loader\StandardAutoloader(array(
+ Zend\Loader\StandardAutoloader::LOAD_NS => array(
+ 'Zend' => __DIR__ . '/../library',
+ 'ZendTest' => __DIR__ . '/Zend',
+ ),
+));
+$loader->register();
View
@@ -0,0 +1,5 @@
+!.gitignore
+.composer
+composer
+doctrine
+autoload.php

0 comments on commit fb4d379

Please sign in to comment.