Skip to content
This repository
Browse code

[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...
commit fb4d3797954e24dd4635aa3901ae4a9969eee240 1 parent 4f5263e
Matthew Weier O'Phinney weierophinney authored
4 .travis.yml
@@ -7,9 +7,11 @@ php:
7 7
8 8 before_install:
9 9 - cp tests/TestConfiguration.php.travis tests/TestConfiguration.php
  10 + - curl -s http://getcomposer.org/installer | php
  11 + - php composer.phar install
10 12
11 13 script:
12 14 - php ./tests/run-tests.php
13 15
14 16 notifications:
15   - irc: "irc.freenode.org#zftalk.2"
  17 + irc: "irc.freenode.org#zftalk.2"
3  composer.json
@@ -9,7 +9,8 @@
9 9 "homepage": "http://framework.zend.com/",
10 10 "license": "BSD-3-Clause",
11 11 "require": {
12   - "php": ">=5.3.3"
  12 + "php": ">=5.3.3",
  13 + "doctrine/common": ">=2.1"
13 14 },
14 15 "autoload": {
15 16 "psr-0": {
59 tests/_autoload.php
@@ -2,55 +2,14 @@
2 2 /**
3 3 * Setup autoloading
4 4 */
5   -function ZendTest_Autoloader($class)
6   -{
7   - $class = ltrim($class, '\\');
8   -
9   - if (!preg_match('#^(Zend(Test)?|PHPUnit)(\\\\|_)#', $class)) {
10   - return false;
11   - }
12   -
13   - // $segments = explode('\\', $class); // preg_split('#\\\\|_#', $class);//
14   - $segments = preg_split('#[\\\\_]#', $class); // preg_split('#\\\\|_#', $class);//
15   - $ns = array_shift($segments);
16   -
17   - switch ($ns) {
18   - case 'Zend':
19   - $file = dirname(__DIR__) . '/library/Zend/';
20   - break;
21   - case 'ZendTest':
22   - // temporary fix for ZendTest namespace until we can migrate files
23   - // into ZendTest dir
24   - $file = __DIR__ . '/Zend/';
25   - break;
26   - default:
27   - $file = false;
28   - break;
29   - }
30   -
31   - if ($file) {
32   - $file .= implode('/', $segments) . '.php';
33   - if (file_exists($file)) {
34   - return include_once $file;
35   - }
36   - }
37   -
38   - $segments = explode('_', $class);
39   - $ns = array_shift($segments);
40   -
41   - switch ($ns) {
42   - case 'Zend':
43   - $file = dirname(__DIR__) . '/library/Zend/';
44   - break;
45   - default:
46   - return false;
47   - }
48   - $file .= implode('/', $segments) . '.php';
49   - if (file_exists($file)) {
50   - return include_once $file;
51   - }
52   -
53   - return false;
  5 +if (!include_once __DIR__ . '/../vendor/autoload.php') {
  6 + throw new UnexpectedValueException('Could not find composer; did you run `php composer.phar install`?');
54 7 }
55   -spl_autoload_register('ZendTest_Autoloader', true, true);
56 8
  9 +$loader = new Zend\Loader\StandardAutoloader(array(
  10 + Zend\Loader\StandardAutoloader::LOAD_NS => array(
  11 + 'Zend' => __DIR__ . '/../library',
  12 + 'ZendTest' => __DIR__ . '/Zend',
  13 + ),
  14 +));
  15 +$loader->register();
5 vendor/.gitignore
... ... @@ -0,0 +1,5 @@
  1 +!.gitignore
  2 +.composer
  3 +composer
  4 +doctrine
  5 +autoload.php

0 comments on commit fb4d379

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