forked from reactphp/reactphp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
31 lines (26 loc) · 1.21 KB
/
Copy pathbootstrap.php
File metadata and controls
31 lines (26 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$autoload = require __DIR__ . '/../vendor/autoload.php';
// register all `autoload-dev` paths from React's components
foreach (glob(__DIR__ . '/../vendor/react/*/composer.json') as $b) {
$config = json_decode(file_get_contents($b), true);
if (isset($config['autoload-dev']['psr-4'])) {
$base = dirname($b) . '/';
foreach ($config['autoload-dev']['psr-4'] as $namespace => $paths) {
foreach ((array)$paths as $path) {
$autoload->addPsr4($namespace, $base . $path);
}
}
}
}
// load all legacy test bootstrap scripts from React's components
foreach (glob(__DIR__ . '/../vendor/react/*/tests/bootstrap.php') as $b) {
// skip legacy react/promise for now and use manual autoload path from bootstrap config
// @link https://github.com/reactphp/promise/blob/1.x/tests/bootstrap.php
// @link https://github.com/reactphp/promise/blob/2.x/tests/bootstrap.php
if (strpos($b, 'react/promise/tests/bootstrap.php') !== false) {
$autoload->add('React\Promise', __DIR__ . '/../vendor/react/promise/tests');
$autoload->addPsr4('React\\Promise\\', __DIR__ . '/../vendor/react/promise/tests');
continue;
}
include $b;
}