Skip to content

Commit 96ede40

Browse files
MAGETWO-69535: Error during importing new list of scopes through shared file
1 parent b33d324 commit 96ede40

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

app/code/Magento/Store/App/Config/Source/InitialConfigSource.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ public function get($path = '')
6666
$data = new DataObject($this->reader->load());
6767

6868
if ($path !== '' && $path !== null) {
69-
$path = ltrim($path, '/');
70-
$path = '/' . $path;
69+
$path = '/' . ltrim($path, '/');
7170
}
7271

7372
return $data->getData($this->configType . $path) ?: [];

app/code/Magento/Store/Test/Unit/Model/Config/ImporterTest.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ protected function setUp()
7676
$this->resourceMock = $this->getMockBuilder(Website::class)
7777
->disableOriginalConstructor()
7878
->getMock();
79-
$this->processorFactoryMock->expects($this->any())
80-
->method('create')
81-
->willReturn($this->processorMock);
8279

8380
$this->model = new Importer(
8481
$this->dataDifferenceCalculatorMock,
@@ -97,9 +94,30 @@ public function testImport()
9794
ScopeInterface::SCOPE_WEBSITES => ['websites'],
9895
];
9996

97+
$createProcessorMock = clone $this->processorMock;
98+
$deleteProcessorMock = clone $this->processorMock;
99+
$updateProcessorMock = clone $this->processorMock;
100+
101+
$this->processorFactoryMock->expects($this->exactly(3))
102+
->method('create')
103+
->withConsecutive(
104+
[Importer\Processor\ProcessorFactory::TYPE_CREATE],
105+
[Importer\Processor\ProcessorFactory::TYPE_DELETE],
106+
[Importer\Processor\ProcessorFactory::TYPE_UPDATE]
107+
)->willReturnOnConsecutiveCalls(
108+
$createProcessorMock,
109+
$deleteProcessorMock,
110+
$updateProcessorMock
111+
);
100112
$this->resourceMock->expects($this->once())
101113
->method('beginTransaction');
102-
$this->processorMock->expects($this->exactly(3))
114+
$createProcessorMock->expects($this->once())
115+
->method('run')
116+
->with($data);
117+
$deleteProcessorMock->expects($this->once())
118+
->method('run')
119+
->with($data);
120+
$updateProcessorMock->expects($this->once())
103121
->method('run')
104122
->with($data);
105123
$this->resourceMock->expects($this->once())
@@ -133,6 +151,9 @@ public function testImport()
133151
*/
134152
public function testImportWithException()
135153
{
154+
$this->processorFactoryMock->expects($this->any())
155+
->method('create')
156+
->willReturn($this->processorMock);
136157
$this->resourceMock->expects($this->once())
137158
->method('beginTransaction');
138159
$this->processorMock->expects($this->any())

0 commit comments

Comments
 (0)