File: TestInit.php

package info (click to toggle)
doctrine 3.3.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 11,236 kB
  • sloc: php: 105,633; xml: 1,312; makefile: 35; sh: 14
file content (39 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (2)
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
32
33
34
35
36
37
38
39
<?php

declare(strict_types=1);

/*
 * This file bootstraps the test environment.
 */

namespace Doctrine\Tests;

use Exception;

use function date_default_timezone_set;
use function error_reporting;
use function file_exists;
use function mkdir;

use const E_ALL;

error_reporting(E_ALL);
date_default_timezone_set('UTC');

if (file_exists(__DIR__ . '/../../vendor/autoload.php')) {
    // dependencies were installed via composer - this is the main project
    require __DIR__ . '/../../vendor/autoload.php';
} elseif (file_exists(__DIR__ . '/../../../../autoload.php')) {
    // installed as a dependency in `vendor`
    require __DIR__ . '/../../../../autoload.php';
} else {
    throw new Exception('Can\'t find autoload.php. Did you install dependencies via composer?');
}

if (! file_exists(__DIR__ . '/Proxies') && ! mkdir(__DIR__ . '/Proxies')) {
    throw new Exception('Could not create ' . __DIR__ . '/Proxies Folder.');
}

if (! file_exists(__DIR__ . '/ORM/Proxy/generated') && ! mkdir(__DIR__ . '/ORM/Proxy/generated')) {
    throw new Exception('Could not create ' . __DIR__ . '/ORM/Proxy/generated Folder.');
}