Skip to content

Commit 2f04074

Browse files
author
Oleksii Korshenko
authored
Merge pull request #1058 from magento-engcom/develop-prs
Public Pull Requests: #9129 #5372
2 parents 0e3a90f + e151a82 commit 2f04074

File tree

6 files changed

+88
-6
lines changed

6 files changed

+88
-6
lines changed

app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Wizard.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ public function execute()
3838
$this->productBuilder->build($this->getRequest());
3939

4040
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
41-
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
42-
$resultLayout->getLayout()->getUpdate()->removeHandle('default');
43-
41+
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
4442
return $resultLayout;
4543
}
4644
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\ConfigurableProduct\Test\Unit\Controller\Adminhtml\Product;
8+
9+
use Magento\Framework\Controller\ResultFactory;
10+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
11+
12+
class WizardTest extends \PHPUnit_Framework_TestCase
13+
{
14+
/**
15+
* @var \PHPUnit_Framework_MockObject_MockObject
16+
*/
17+
private $resultFactory;
18+
19+
/**
20+
* @var \PHPUnit_Framework_MockObject_MockObject
21+
*/
22+
private $productBuilder;
23+
24+
/**
25+
* @var \PHPUnit_Framework_MockObject_MockObject
26+
*/
27+
private $request;
28+
29+
/**
30+
* @var \Magento\ConfigurableProduct\Controller\Adminhtml\Product\Wizard
31+
*/
32+
private $model;
33+
34+
protected function setUp()
35+
{
36+
$this->resultFactory = $this->getMockBuilder(\Magento\Framework\Controller\ResultFactory::class)
37+
->disableOriginalConstructor()
38+
->getMock();
39+
$this->productBuilder = $this->getMockBuilder(\Magento\Catalog\Controller\Adminhtml\Product\Builder::class)
40+
->disableOriginalConstructor()
41+
->setMethods(['build'])
42+
->getMock();
43+
$this->request = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)
44+
->disableOriginalConstructor()
45+
->getMock();
46+
$context = $this->getMockBuilder(\Magento\Backend\App\Action\Context::class)
47+
->disableOriginalConstructor()
48+
->getMock();
49+
50+
$context->expects($this->any())->method('getResultFactory')->willReturn($this->resultFactory);
51+
$context->expects($this->any())->method('getRequest')->willReturn($this->request);
52+
53+
$objectManagerHelper = new ObjectManagerHelper($this);
54+
$this->model = $objectManagerHelper->getObject(
55+
\Magento\ConfigurableProduct\Controller\Adminhtml\Product\Wizard::class,
56+
[
57+
'context' => $context,
58+
'productBuilder' => $this->productBuilder
59+
]
60+
);
61+
}
62+
63+
public function testExecute()
64+
{
65+
$this->productBuilder->expects($this->once())->method('build')->with($this->request);
66+
$this->resultFactory->expects($this->once())->method('create')->with(ResultFactory::TYPE_LAYOUT);
67+
68+
$this->model->execute();
69+
}
70+
}

lib/internal/Magento/Framework/Filesystem/Driver/File.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,13 @@ public function fileUnlock($resource)
843843
*/
844844
public function getAbsolutePath($basePath, $path, $scheme = null)
845845
{
846+
// check if the path given is already an absolute path containing the
847+
// basepath. so if the basepath starts at position 0 in the path, we
848+
// must not concatinate them again because path is already absolute.
849+
if (0 === strpos($path, $basePath)) {
850+
return $this->getScheme($scheme) . $path;
851+
}
852+
846853
return $this->getScheme($scheme) . $basePath . ltrim($this->fixSeparator($path), '/');
847854
}
848855

lib/internal/Magento/Framework/Filesystem/Driver/Http.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ public function fileReadLine($resource, $length, $ending = null)
213213
*/
214214
public function getAbsolutePath($basePath, $path, $scheme = null)
215215
{
216+
// check if the path given is already an absolute path containing the
217+
// basepath. so if the basepath starts at position 0 in the path, we
218+
// must not concatinate them again because path is already absolute.
219+
if (0 === strpos($path, $basePath)) {
220+
return $this->getScheme() . $path;
221+
}
222+
216223
return $this->getScheme() . $basePath . $path;
217224
}
218225

lib/internal/Magento/Framework/Filesystem/Test/Unit/Driver/FileTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public function testGetAbsolutePath($basePath, $path, $expected)
3030
$file = new File();
3131
$this->assertEquals($expected, $file->getAbsolutePath($basePath, $path));
3232
}
33-
33+
3434
public function dataProviderForTestGetAbsolutePath()
3535
{
3636
return [
3737
['/root/path/', 'sub', '/root/path/sub'],
3838
['/root/path/', '/sub', '/root/path/sub'],
3939
['/root/path/', '../sub', '/root/path/../sub'],
40-
['/root/path/', '/root/path/sub', '/root/path/root/path/sub'],
40+
['/root/path/', '/root/path/sub', '/root/path/sub'],
4141
];
4242
}
4343

setup/src/Magento/Setup/Module/I18n/Dictionary/Writer/Csv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __destructor()
6969
*/
7070
public function __destruct()
7171
{
72-
if (is_resource($this->_fileHandler)) {
72+
if ($this->_fileHandler !== STDOUT && is_resource($this->_fileHandler)) {
7373
fclose($this->_fileHandler);
7474
}
7575
}

0 commit comments

Comments
 (0)