Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
bootstrap.php
Go to the documentation of this file.
1 <?php
7 defined('MTF_BOOT_FILE') || define('MTF_BOOT_FILE', __FILE__);
8 defined('MTF_BP') || define('MTF_BP', str_replace('\\', '/', (__DIR__)));
9 defined('BP') || define('BP', str_replace('\\', '/', dirname(dirname(dirname((__DIR__))))));
10 defined('MTF_TESTS_PATH') || define('MTF_TESTS_PATH', MTF_BP . '/tests/app/');
11 defined('MTF_STATES_PATH') || define('MTF_STATES_PATH', MTF_BP . '/lib/Magento/Mtf/App/State/');
12 
13 restore_error_handler();
14 include __DIR__ . '/vendor/autoload.php';
16 
17 /* Custom umask value may be provided in optional mage_umask file in root */
18 $umaskFile = BP . '/magento_umask';
19 $mask = file_exists($umaskFile) ? octdec(file_get_contents($umaskFile)) : 002;
20 umask($mask);
21 
22 date_default_timezone_set('UTC');
23 
24 /* For data consistency between displaying (printing) and serialization a float number */
25 ini_set('precision', 14);
26 ini_set('serialize_precision', 14);
27 
32 {
33  set_error_handler(
34  function ($errNo, $errStr, $errFile, $errLine) {
35  if (error_reporting()) {
36  $errorNames = [
37  E_ERROR => 'Error',
38  E_WARNING => 'Warning',
39  E_PARSE => 'Parse',
40  E_NOTICE => 'Notice',
41  E_CORE_ERROR => 'Core Error',
42  E_CORE_WARNING => 'Core Warning',
43  E_COMPILE_ERROR => 'Compile Error',
44  E_COMPILE_WARNING => 'Compile Warning',
45  E_USER_ERROR => 'User Error',
46  E_USER_WARNING => 'User Warning',
47  E_USER_NOTICE => 'User Notice',
48  E_STRICT => 'Strict',
49  E_RECOVERABLE_ERROR => 'Recoverable Error',
50  E_DEPRECATED => 'Deprecated',
51  E_USER_DEPRECATED => 'User Deprecated',
52  ];
53 
54  $errName = isset($errorNames[$errNo]) ? $errorNames[$errNo] : "";
55 
56  throw new \PHPUnit\Framework\Exception(
57  sprintf("%s: %s in %s:%s.", $errName, $errStr, $errFile, $errLine),
58  $errNo
59  );
60  }
61  }
62  );
63 }
ini_set($varName, $newValue)
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
defined('MTF_BOOT_FILE')||define('MTF_BOOT_FILE' __FILE__
Definition: bootstrap.php:7
$mask
Definition: bootstrap.php:36
defined('MTF_TESTS_PATH')||define('MTF_TESTS_PATH' MTF_BP
Definition: bootstrap.php:10
$umaskFile
Definition: bootstrap.php:35
const BP
Definition: autoload.php:14
catch(\Exception $e) setCustomErrorHandler()
Definition: bootstrap.php:106