Skip to content

Commit 04ffb8e

Browse files
author
Ivan Gavryshko
committed
MAGETWO-37765: Unable to run indexer as part of an install
- renamed classes according to CR feedback, deleted unused dependency
1 parent b368610 commit 04ffb8e

File tree

6 files changed

+31
-41
lines changed

6 files changed

+31
-41
lines changed

app/code/Magento/Developer/Console/Command/XmlConverterCommand.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
use Symfony\Component\Console\Input\InputInterface;
1313
use Symfony\Component\Console\Output\OutputInterface;
1414
use Magento\Developer\Model\Tools\Formatter;
15-
use Magento\Framework\DomDocument\Factory;
16-
use Magento\Framework\XSLTProcessor\Factory as XSLTProcessorFactory;
15+
use Magento\Framework\DomDocument\DomDocumentFactory;
16+
use Magento\Framework\XsltProcessor\XsltProcessorFactory;
1717

1818
/**
1919
* Class XmlConverterCommand
@@ -42,26 +42,26 @@ class XmlConverterCommand extends Command
4242
private $formatter;
4343

4444
/**
45-
* @var Factory
45+
* @var DomDocumentFactory
4646
*/
4747
private $domFactory;
4848

4949
/**
50-
* @var XSLTProcessorFactory
50+
* @var XsltProcessorFactory
5151
*/
5252
private $xsltProcessorFactory;
5353

5454
/**
5555
* Inject dependencies
5656
*
5757
* @param Formatter $formatter
58-
* @param Factory $domFactory
59-
* @param xsltProcessorFactory $xsltProcessorFactory
58+
* @param DomDocumentFactory $domFactory
59+
* @param XsltProcessorFactory $xsltProcessorFactory
6060
*/
6161
public function __construct(
6262
Formatter $formatter,
63-
Factory $domFactory,
64-
XSLTProcessorFactory $xsltProcessorFactory
63+
DomDocumentFactory $domFactory,
64+
XsltProcessorFactory $xsltProcessorFactory
6565
) {
6666
$this->formatter = $formatter;
6767
$this->domFactory = $domFactory;
@@ -106,9 +106,9 @@ protected function configure()
106106
protected function execute(InputInterface $input, OutputInterface $output)
107107
{
108108
try {
109-
$domXml = $this->domFactory->createDomDocument();
110-
$domXsl = $this->domFactory->createDomDocument();
111-
$xsltProcessor = $this->xsltProcessorFactory->createXSLTProcessor();
109+
$domXml = $this->domFactory->create();
110+
$domXsl = $this->domFactory->create();
111+
$xsltProcessor = $this->xsltProcessorFactory->create();
112112

113113
$xmlFile = $input->getArgument(self::XML_FILE_ARGUMENT);
114114
$domXml->preserveWhiteSpace = true;

app/code/Magento/Developer/Test/Unit/Console/Command/XmlConverterCommandTest.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Magento\Developer\Console\Command\XmlConverterCommand;
1010
use Symfony\Component\Console\Tester\CommandTester;
1111
use Magento\Developer\Model\Tools\Formatter;
12-
use Magento\Framework\DomDocument\Factory;
13-
use Magento\Framework\XSLTProcessor\Factory as XSLTProcessorFactory;
12+
use Magento\Framework\DomDocument\DomDocumentFactory;
13+
use Magento\Framework\XsltProcessor\XsltProcessorFactory;
1414

1515
class XmlConverterCommandTest extends \PHPUnit_Framework_TestCase
1616
{
@@ -25,20 +25,26 @@ class XmlConverterCommandTest extends \PHPUnit_Framework_TestCase
2525
private $command;
2626

2727
/**
28-
* @var Factory|\PHPUnit_Framework_MockObject_MockObject
28+
* @var DomDocumentFactory|\PHPUnit_Framework_MockObject_MockObject
2929
*/
3030
private $domFactory;
3131

3232
/**
33-
* @var XSLTProcessorFactory|\PHPUnit_Framework_MockObject_MockObject
33+
* @var XsltProcessorFactory|\PHPUnit_Framework_MockObject_MockObject
3434
*/
3535
private $xsltProcessorFactory;
3636

3737
public function setUp()
3838
{
3939
$this->formatter = $this->getMock('Magento\Developer\Model\Tools\Formatter', [], [], '', false);
40-
$this->domFactory = $this->getMock('Magento\Framework\DomDocument\Factory', [], [], '', false);
41-
$this->xsltProcessorFactory = $this->getMock('Magento\Framework\XSLTProcessor\Factory', [], [], '', false);
40+
$this->domFactory = $this->getMock('Magento\Framework\DomDocument\DomDocumentFactory', [], [], '', false);
41+
$this->xsltProcessorFactory = $this->getMock(
42+
'Magento\Framework\XsltProcessor\XsltProcessorFactory',
43+
[],
44+
[],
45+
'',
46+
false
47+
);
4248

4349
$this->command = new XmlConverterCommand($this->formatter, $this->domFactory, $this->xsltProcessorFactory);
4450
}
@@ -50,13 +56,13 @@ public function testExecute()
5056
$domXml->expects($this->once())->method('load')->with('file.xml');
5157
$domXsl->expects($this->once())->method('load')->with('file.xsl');
5258

53-
$this->domFactory->expects($this->at(0))->method('createDomDocument')->willReturn($domXml);
54-
$this->domFactory->expects($this->at(1))->method('createDomDocument')->willReturn($domXsl);
59+
$this->domFactory->expects($this->at(0))->method('create')->willReturn($domXml);
60+
$this->domFactory->expects($this->at(1))->method('create')->willReturn($domXsl);
5561

5662
$xsltProcessor = $this->getMock('XSLTProcessor', [], [], '', false);
5763
$xsltProcessor->expects($this->once())->method('transformToXml')->with($domXml)->willReturn('XML');
5864

59-
$this->xsltProcessorFactory->expects($this->once())->method('createXSLTProcessor')->willReturn($xsltProcessor);
65+
$this->xsltProcessorFactory->expects($this->once())->method('create')->willReturn($xsltProcessor);
6066

6167
$this->formatter->expects($this->once())->method('format')->with('XML')->willReturn('result');
6268

app/code/Magento/Webapi/Model/Soap/Server.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ class Server
3131
*/
3232
protected $_configScope;
3333

34-
/**
35-
* @var \Magento\Framework\DomDocument\Factory
36-
*/
37-
protected $_domDocumentFactory;
38-
3934
/**
4035
* @var \Magento\Webapi\Controller\Soap\Request
4136
*/
@@ -67,7 +62,6 @@ class Server
6762
* @param \Magento\Framework\App\AreaList $areaList
6863
* @param \Magento\Framework\Config\ScopeInterface $configScope
6964
* @param \Magento\Webapi\Controller\Soap\Request $request
70-
* @param \Magento\Framework\DomDocument\Factory $domDocumentFactory
7165
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
7266
* @param \Magento\Webapi\Model\Soap\ServerFactory $soapServerFactory
7367
* @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
@@ -78,7 +72,6 @@ public function __construct(
7872
\Magento\Framework\App\AreaList $areaList,
7973
\Magento\Framework\Config\ScopeInterface $configScope,
8074
\Magento\Webapi\Controller\Soap\Request $request,
81-
\Magento\Framework\DomDocument\Factory $domDocumentFactory,
8275
\Magento\Store\Model\StoreManagerInterface $storeManager,
8376
\Magento\Webapi\Model\Soap\ServerFactory $soapServerFactory,
8477
\Magento\Framework\Reflection\TypeProcessor $typeProcessor,
@@ -94,7 +87,6 @@ public function __construct(
9487
$this->_areaList = $areaList;
9588
$this->_configScope = $configScope;
9689
$this->_request = $request;
97-
$this->_domDocumentFactory = $domDocumentFactory;
9890
$this->_storeManager = $storeManager;
9991
$this->_soapServerFactory = $soapServerFactory;
10092
$this->_typeProcessor = $typeProcessor;

app/code/Magento/Webapi/Test/Unit/Model/Soap/ServerTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ class ServerTest extends \PHPUnit_Framework_TestCase
1818
/** @var \Magento\Webapi\Controller\Soap\Request */
1919
protected $_requestMock;
2020

21-
/** @var \Magento\Framework\DomDocument\Factory */
22-
protected $_domDocumentFactory;
23-
2421
/** @var \Magento\Store\Model\StoreManagerInterface */
2522
protected $_storeManagerMock;
2623

@@ -67,10 +64,6 @@ protected function setUp()
6764
'Magento\Webapi\Controller\Soap\Request'
6865
)->disableOriginalConstructor()->getMock();
6966

70-
$this->_domDocumentFactory = $this->getMockBuilder(
71-
'Magento\Framework\DomDocument\Factory'
72-
)->disableOriginalConstructor()->getMock();
73-
7467
$this->_soapServerFactory = $this->getMockBuilder(
7568
'Magento\Webapi\Model\Soap\ServerFactory'
7669
)->disableOriginalConstructor()->getMock();
@@ -90,7 +83,6 @@ protected function setUp()
9083
$areaListMock,
9184
$configScopeMock,
9285
$this->_requestMock,
93-
$this->_domDocumentFactory,
9486
$this->_storeManagerMock,
9587
$this->_soapServerFactory,
9688
$this->_typeProcessor,

lib/internal/Magento/Framework/DomDocument/Factory.php renamed to lib/internal/Magento/Framework/DomDocument/DomDocumentFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
/**
99
* DOM document factory
1010
*/
11-
class Factory
11+
class DomDocumentFactory
1212
{
1313
/**
1414
* Create empty DOM document instance.
1515
*
1616
* @return \DOMDocument
1717
*/
18-
public function createDomDocument()
18+
public function create()
1919
{
2020
return new \DOMDocument();
2121
}

lib/internal/Magento/Framework/XSLTProcessor/Factory.php renamed to lib/internal/Magento/Framework/XSLTProcessor/XsltProcessorFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
* Copyright © 2015 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Framework\XSLTProcessor;
6+
namespace Magento\Framework\XsltProcessor;
77

88
/**
99
* XSLTProcessor document factory
1010
*/
11-
class Factory
11+
class XsltProcessorFactory
1212
{
1313
/**
1414
* Create empty XSLTProcessor instance.
1515
*
1616
* @return \XSLTProcessor
1717
*/
18-
public function createXSLTProcessor()
18+
public function create()
1919
{
2020
return new \XSLTProcessor();
2121
}

0 commit comments

Comments
 (0)