Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
ProfilerTest Class Reference
Inheritance diagram for ProfilerTest:

Public Member Functions

 testApplyConfigWithDrivers (array $config, array $expectedDrivers)
 
 applyConfigDataProvider ()
 

Protected Member Functions

 tearDown ()
 

Detailed Description

Definition at line 10 of file ProfilerTest.php.

Member Function Documentation

◆ applyConfigDataProvider()

applyConfigDataProvider ( )
Returns
array

Definition at line 31 of file ProfilerTest.php.

32  {
33  return [
34  'Empty config does not create any driver' => ['config' => [], 'drivers' => []],
35  'Integer 0 does not create any driver' => [
36  'config' => ['drivers' => [0]],
37  'drivers' => [],
38  ],
39  'Integer 1 does creates standard driver' => [
40  'config' => ['drivers' => [1]],
41  'drivers' => [new \Magento\Framework\Profiler\Driver\Standard()],
42  ],
43  'Config array key sets driver type' => [
44  'configs' => ['drivers' => ['standard' => 1]],
45  'drivers' => [new \Magento\Framework\Profiler\Driver\Standard()],
46  ],
47  'Config array key ignored when type set' => [
48  'config' => ['drivers' => ['custom' => ['type' => 'standard']]],
49  'drivers' => [new \Magento\Framework\Profiler\Driver\Standard()],
50  ],
51  'Config with outputs element as integer 1 creates output' => [
52  'config' => [
53  'drivers' => [['outputs' => ['html' => 1]]],
54  'baseDir' => '/some/base/dir',
55  ],
56  'drivers' => [
57  new \Magento\Framework\Profiler\Driver\Standard(
58  ['outputs' => [['type' => 'html', 'baseDir' => '/some/base/dir']]]
59  ),
60  ],
61  ],
62  'Config with outputs element as integer 0 does not create output' => [
63  'config' => ['drivers' => [['outputs' => ['html' => 0]]]],
64  'drivers' => [new \Magento\Framework\Profiler\Driver\Standard()],
65  ],
66  'Config with shortly defined outputs element' => [
67  'config' => ['drivers' => [['outputs' => ['foo' => 'html']]]],
68  'drivers' => [
69  new \Magento\Framework\Profiler\Driver\Standard(['outputs' => [['type' => 'html']]]),
70  ],
71  ],
72  'Config with fully defined outputs element options' => [
73  'config' => [
74  'drivers' => [
75  [
76  'outputs' => [
77  'foo' => [
78  'type' => 'html',
79  'filterName' => '/someFilter/',
80  'thresholds' => ['someKey' => 123],
81  'baseDir' => '/custom/dir',
82  ],
83  ],
84  ],
85  ],
86  ],
87  'drivers' => [
88  new \Magento\Framework\Profiler\Driver\Standard(
89  [
90  'outputs' => [
91  [
92  'type' => 'html',
93  'filterName' => '/someFilter/',
94  'thresholds' => ['someKey' => 123],
95  'baseDir' => '/custom/dir',
96  ],
97  ],
98  ]
99  ),
100  ],
101  ],
102  'Config with shortly defined output' => [
103  'config' => ['drivers' => [['output' => 'html']]],
104  'drivers' => [
105  new \Magento\Framework\Profiler\Driver\Standard(['outputs' => [['type' => 'html']]]),
106  ],
107  ]
108  ];
109  }

◆ tearDown()

tearDown ( )
protected

Definition at line 12 of file ProfilerTest.php.

◆ testApplyConfigWithDrivers()

testApplyConfigWithDrivers ( array  $config,
array  $expectedDrivers 
)

@dataProvider applyConfigDataProvider

Parameters
array$config
array$expectedDrivers

Definition at line 22 of file ProfilerTest.php.

23  {
25  $this->assertAttributeEquals($expectedDrivers, '_drivers', \Magento\Framework\Profiler::class);
26  }
$config
Definition: fraud_order.php:17
static applyConfig($config, $baseDir, $isAjax=false)
Definition: Profiler.php:332

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