mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-03-10 09:36:10 +03:00
Allow running tests without surrounding framework
This commit is contained in:
parent
ef40b1c3c2
commit
1e1a35aed5
@ -12,6 +12,22 @@ if ((!$loader = includeIfExists(__DIR__.'/../../../../../.composer/autoload.php'
|
|||||||
'php composer.phar install'.PHP_EOL);
|
'php composer.phar install'.PHP_EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
|
spl_autoload_register(function($class) {
|
||||||
|
if (0 === strpos($class, 'Nelmio\ApiDocBundle\\')) {
|
||||||
|
$path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php';
|
||||||
|
if (!stream_resolve_include_path($path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
require_once $path;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return $loader;
|
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||||
|
AnnotationRegistry::registerLoader(function($class) {
|
||||||
|
if (strpos($class, 'Nelmio\ApiDocBundle\Annotation\\') === 0) {
|
||||||
|
$path = __DIR__.'/../'.str_replace('\\', '/', substr($class, strlen('Nelmio\ApiDocBundle\\'))) .'.php';
|
||||||
|
require_once $path;
|
||||||
|
}
|
||||||
|
return class_exists($class, false);
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user