24 $this->_stat = $this->createMock(\
Magento\Framework\
Profiler\Driver\Standard\Stat::class);
25 $this->_driver = new \Magento\Framework\Profiler\Driver\Standard([
'stat' => $this->_stat]);
38 $driver = new \Magento\Framework\Profiler\Driver\Standard();
39 $this->assertAttributeInstanceOf(\
Magento\Framework\
Profiler\Driver\Standard\Stat::class,
'_stat', $driver);
47 $this->_stat->expects($this->once())->method(
'clear')->with(
'timer_id');
48 $this->_driver->clear(
'timer_id');
56 $this->_stat->expects(
62 $this->greaterThanOrEqual(microtime(
true)),
63 $this->greaterThanOrEqual(0),
64 $this->greaterThanOrEqual(0)
66 $this->_driver->start(
'timer_id');
74 $this->_stat->expects(
80 $this->greaterThanOrEqual(microtime(
true)),
81 $this->greaterThanOrEqual(0),
82 $this->greaterThanOrEqual(0)
84 $this->_driver->stop(
'timer_id');
92 $outputFactory = $this->createMock(\
Magento\Framework\
Profiler\Driver\Standard\Output\Factory::class);
95 'outputTypeOne' => [
'baseDir' =>
'/custom/base/dir'],
96 'outputTypeTwo' => [
'type' =>
'specificOutputTypeTwo'],
98 'baseDir' =>
'/base/dir',
99 'outputFactory' => $outputFactory,
102 $outputOne = $this->createMock(\
Magento\Framework\
Profiler\Driver\Standard\OutputInterface::class);
103 $outputTwo = $this->createMock(\
Magento\Framework\
Profiler\Driver\Standard\OutputInterface::class);
105 $outputFactory->expects(
110 [
'baseDir' =>
'/custom/base/dir',
'type' =>
'outputTypeOne']
112 $this->returnValue($outputOne)
115 $outputFactory->expects(
120 [
'type' =>
'specificOutputTypeTwo',
'baseDir' =>
'/base/dir']
122 $this->returnValue($outputTwo)
125 $driver = new \Magento\Framework\Profiler\Driver\Standard(
$config);
126 $this->assertAttributeCount(2,
'_outputs', $driver);
127 $this->assertAttributeEquals([$outputOne, $outputTwo],
'_outputs', $driver);
135 $outputOne = $this->createMock(\
Magento\Framework\
Profiler\Driver\Standard\OutputInterface::class);
136 $outputOne->expects($this->once())->method(
'display')->with($this->_stat);
137 $outputTwo = $this->createMock(\
Magento\Framework\
Profiler\Driver\Standard\OutputInterface::class);
138 $outputTwo->expects($this->once())->method(
'display')->with($this->_stat);
140 $this->_driver->registerOutput($outputOne);
141 $this->_driver->registerOutput($outputTwo);
143 $this->_driver->display();
145 $this->_driver->display();
153 $method = new \ReflectionMethod($this->_driver,
'_getOutputFactory');
155 $this->assertInstanceOf(
157 $method->invoke($this->_driver)
testDisplayAndRegisterOutput()
testDefaultOutputFactory()