Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
bootstrap.php
Go to the documentation of this file.
1 <?php
7 require_once __DIR__ . '/../../../../app/autoload.php';
8 
9 if (!defined('TESTS_TEMP_DIR')) {
10  define('TESTS_TEMP_DIR', dirname(__DIR__) . '/tmp');
11 }
12 
13 require_once __DIR__ . '/autoload.php';
14 
16 
17 \Magento\Framework\Phrase::setRenderer(new \Magento\Framework\Phrase\Renderer\Placeholder());
18 
19 error_reporting(E_ALL);
20 ini_set('display_errors', 1);
21 
22 /* For data consistency between displaying (printing) and serialization a float number */
23 ini_set('precision', 14);
24 ini_set('serialize_precision', 14);
25 
30 {
31  set_error_handler(
32  function ($errNo, $errStr, $errFile, $errLine) {
33  if (error_reporting()) {
34  $errorNames = [
35  E_ERROR => 'Error',
36  E_WARNING => 'Warning',
37  E_PARSE => 'Parse',
38  E_NOTICE => 'Notice',
39  E_CORE_ERROR => 'Core Error',
40  E_CORE_WARNING => 'Core Warning',
41  E_COMPILE_ERROR => 'Compile Error',
42  E_COMPILE_WARNING => 'Compile Warning',
43  E_USER_ERROR => 'User Error',
44  E_USER_WARNING => 'User Warning',
45  E_USER_NOTICE => 'User Notice',
46  E_STRICT => 'Strict',
47  E_RECOVERABLE_ERROR => 'Recoverable Error',
48  E_DEPRECATED => 'Deprecated',
49  E_USER_DEPRECATED => 'User Deprecated',
50  ];
51 
52  $errName = isset($errorNames[$errNo]) ? $errorNames[$errNo] : "";
53 
54  throw new \PHPUnit\Framework\Exception(
55  sprintf("%s: %s in %s:%s.", $errName, $errStr, $errFile, $errLine),
56  $errNo
57  );
58  }
59  }
60  );
61 }
ini_set($varName, $newValue)
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
static setRenderer(RendererInterface $renderer)
Definition: Phrase.php:46
catch(\Exception $e) setCustomErrorHandler()
Definition: bootstrap.php:106