Skip to content

Commit d8a2dfb

Browse files
author
Oleksandr Iegorov
committed
MAGETWO-54940: Stabilization and preparation for demo
1 parent 65d0085 commit d8a2dfb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/internal/Magento/Framework/App/StaticResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private function getFilesystem()
176176
private function getLogger()
177177
{
178178
if (!$this->logger) {
179-
$this->logger = $this->objectManager->create(LoggerInterface::class);
179+
$this->logger = $this->objectManager->get(LoggerInterface::class);
180180
}
181181

182182
return $this->logger;

lib/internal/Magento/Framework/App/Test/Unit/StaticResourceTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class StaticResourceTest extends \PHPUnit_Framework_TestCase
5858
*/
5959
private $object;
6060

61+
/**
62+
* @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
63+
*/
64+
private $logger;
65+
6166
protected function setUp()
6267
{
6368
$this->state = $this->getMock('Magento\Framework\App\State', [], [], '', false);
@@ -67,6 +72,7 @@ protected function setUp()
6772
$this->assetRepo = $this->getMock('Magento\Framework\View\Asset\Repository', [], [], '', false);
6873
$this->moduleList = $this->getMock('Magento\Framework\Module\ModuleList', [], [], '', false);
6974
$this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
75+
$this->logger = $this->getMockForAbstractClass('Psr\Log\LoggerInterface');
7076
$this->configLoader = $this->getMock(
7177
'Magento\Framework\App\ObjectManager\ConfigLoader', [], [], '', false
7278
);
@@ -193,6 +199,10 @@ public function testLaunchWrongPath()
193199

194200
public function testCatchExceptionDeveloperMode()
195201
{
202+
$this->objectManager->expects($this->once())
203+
->method('get')
204+
->with('Psr\Log\LoggerInterface')
205+
->willReturn($this->logger);
196206
$bootstrap = $this->getMockBuilder(Bootstrap::class)->disableOriginalConstructor()->getMock();
197207
$bootstrap->expects($this->once())->method('isDeveloperMode')->willReturn(true);
198208
$exception = new \Exception('Error: nothing works');

0 commit comments

Comments
 (0)