Skip to content

Commit da7b598

Browse files
committed
Replace Zend_Log with Psr\Log\LoggerInterface
1 parent 1a8dd8c commit da7b598

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

lib/internal/Magento/Framework/Shell.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Shell implements ShellInterface
1515
/**
1616
* Logger instance
1717
*
18-
* @var \Zend_Log
18+
* @var \Psr\Log\LoggerInterface
1919
*/
2020
protected $logger;
2121

@@ -26,11 +26,11 @@ class Shell implements ShellInterface
2626

2727
/**
2828
* @param CommandRendererInterface $commandRenderer
29-
* @param \Zend_Log $logger Logger instance to be used to log commands and their output
29+
* @param \Psr\Log\LoggerInterface $logger Logger instance to be used to log commands and their output
3030
*/
3131
public function __construct(
3232
CommandRendererInterface $commandRenderer,
33-
\Zend_Log $logger = null
33+
\Psr\Log\LoggerInterface $logger = null
3434
) {
3535
$this->logger = $logger;
3636
$this->commandRenderer = $commandRenderer;
@@ -76,7 +76,7 @@ public function execute($command, array $arguments = [])
7676
protected function log($message)
7777
{
7878
if ($this->logger) {
79-
$this->logger->log($message, \Zend_Log::INFO);
79+
$this->logger->info($message);
8080
}
8181
}
8282
}

lib/internal/Magento/Framework/Test/Unit/ShellTest.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ class ShellTest extends \PHPUnit_Framework_TestCase
1616
protected $commandRenderer;
1717

1818
/**
19-
* @var \Zend_Log|\PHPUnit_Framework_MockObject_MockObject
19+
* @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
2020
*/
2121
protected $logger;
2222

2323
protected function setUp()
2424
{
25-
$this->logger = $this->getMockBuilder(\Zend_Log::class)
26-
->setMethods(['log'])
25+
$this->logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
2726
->disableOriginalConstructor()
2827
->getMock();
2928
$this->commandRenderer = new \Magento\Framework\Shell\CommandRenderer();
@@ -72,8 +71,8 @@ public function testExecuteLog($command, $commandArgs, $expectedResult, $expecte
7271
foreach ($expectedLogRecords as $logRecordIndex => $expectedLogMessage) {
7372
$expectedLogMessage = str_replace('`', $quoteChar, $expectedLogMessage);
7473
$this->logger->expects($this->at($logRecordIndex))
75-
->method('log')
76-
->with($expectedLogMessage, \Zend_Log::INFO);
74+
->method('info')
75+
->with($expectedLogMessage);
7776
}
7877
$this->_testExecuteCommand(
7978
new \Magento\Framework\Shell($this->commandRenderer, $this->logger),

0 commit comments

Comments
 (0)