Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Protected Attributes
Bootstrap Class Reference

Public Member Functions

 __construct (\Magento\TestFramework\Bootstrap $bootstrap)
 
 getAppTempDir ()
 
 getAppInitParams ()
 
 reinitialize (array $overriddenParams=[])
 
 runApp ()
 
 getBootstrap ()
 
 loadArea ($areaCode)
 

Static Public Member Functions

static setInstance (\Magento\TestFramework\Helper\Bootstrap $instance)
 
static getInstance ()
 
static canTestHeaders ()
 
static getObjectManager ()
 
static setObjectManager (\Magento\Framework\ObjectManagerInterface $objectManager)
 

Protected Attributes

 $_bootstrap
 

Detailed Description

Definition at line 12 of file Bootstrap.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\TestFramework\Bootstrap  $bootstrap)

Constructor

Parameters
\Magento\TestFramework\Bootstrap$bootstrap

Definition at line 75 of file Bootstrap.php.

76  {
77  $this->_bootstrap = $bootstrap;
78  }
if(defined('TESTS_MAGENTO_INSTALLATION') &&TESTS_MAGENTO_INSTALLATION==='enabled') $bootstrap
Definition: bootstrap.php:73

Member Function Documentation

◆ canTestHeaders()

static canTestHeaders ( )
static

Check the possibility to send headers or to use headers related function (like set_cookie)

Returns
bool

Definition at line 62 of file Bootstrap.php.

63  {
64  if (!headers_sent() && extension_loaded('xdebug') && function_exists('xdebug_get_headers')) {
65  return true;
66  }
67  return false;
68  }

◆ getAppInitParams()

getAppInitParams ( )

Retrieve application initialization options

Returns
array

Definition at line 95 of file Bootstrap.php.

96  {
97  return $this->_bootstrap->getApplication()->getInitParams();
98  }

◆ getAppTempDir()

getAppTempDir ( )

Retrieve application installation directory

Returns
string

Definition at line 85 of file Bootstrap.php.

86  {
87  return $this->_bootstrap->getApplication()->getTempDir();
88  }

◆ getBootstrap()

getBootstrap ( )

Get bootstrap object

Returns
\Magento\TestFramework\Bootstrap

Definition at line 145 of file Bootstrap.php.

◆ getInstance()

static getInstance ( )
static

Self instance getter

Returns
\Magento\TestFramework\Helper\Bootstrap
Exceptions

Definition at line 49 of file Bootstrap.php.

50  {
51  if (!self::$_instance) {
52  throw new \Magento\Framework\Exception\LocalizedException(__('Helper instance is not defined yet.'));
53  }
54  return self::$_instance;
55  }
__()
Definition: __.php:13

◆ getObjectManager()

static getObjectManager ( )
static

Retrieve object manager

Returns
\Magento\Framework\ObjectManagerInterface

Definition at line 125 of file Bootstrap.php.

126  {
127  return self::$_objectManager;
128  }

◆ loadArea()

loadArea (   $areaCode)

Load area

Parameters
string$areaCode

Definition at line 154 of file Bootstrap.php.

155  {
156  self::$_objectManager->get(\Magento\Framework\App\State::class)->setAreaCode($areaCode);
157  self::$_objectManager->get(\Magento\Framework\App\AreaList::class)->getArea($areaCode)->load();
158  }

◆ reinitialize()

reinitialize ( array  $overriddenParams = [])

Reinitialize the application instance optionally passing parameters to be overridden. Intended to be used for the tests isolation purposes.

Parameters
array$overriddenParams

Definition at line 106 of file Bootstrap.php.

107  {
108  $this->_bootstrap->getApplication()->reinitialize($overriddenParams);
109  }

◆ runApp()

runApp ( )

Perform the full request processing by the application instance. Intended to be used by the controller tests.

Definition at line 115 of file Bootstrap.php.

116  {
117  $this->_bootstrap->getApplication()->run();
118  }

◆ setInstance()

static setInstance ( \Magento\TestFramework\Helper\Bootstrap  $instance)
static

Set self instance for static access

Parameters
\Magento\TestFramework\Helper\Bootstrap$instance
Exceptions

Definition at line 35 of file Bootstrap.php.

36  {
37  if (self::$_instance) {
38  throw new \Magento\Framework\Exception\LocalizedException(__('Helper instance cannot be redefined.'));
39  }
40  self::$_instance = $instance;
41  }
__()
Definition: __.php:13

◆ setObjectManager()

static setObjectManager ( \Magento\Framework\ObjectManagerInterface  $objectManager)
static

Set object manager

Parameters
\Magento\Framework\ObjectManagerInterface$objectManager

Definition at line 135 of file Bootstrap.php.

136  {
137  self::$_objectManager = $objectManager;
138  }
$objectManager
Definition: bootstrap.php:17

Field Documentation

◆ $_bootstrap

$_bootstrap
protected

Definition at line 27 of file Bootstrap.php.


The documentation for this class was generated from the following file: