-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from magento-api/Bug-Fixes
[API] Bug fixes
- Loading branch information
Showing
15 changed files
with
150 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd"> | ||
<event name="catalog_category_prepare_save"> | ||
<observer name="category_save_rewrites_history_setter" instance="Magento\CatalogUrlRewrite\Observer\CategorySaveRewritesHistorySetter" method="invoke"/> | ||
</event> | ||
<event name="catalog_category_save_after"> | ||
<observer name="process_url_rewrite_saving" instance="Magento\CatalogUrlRewrite\Model\Category\Observer" method="processUrlRewriteSaving"/> | ||
</event> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Config\Test\Unit\Model\Config\Backend\Image; | ||
|
||
class LogoTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \Magento\Config\Model\Config\Backend\Image\Logo | ||
*/ | ||
private $model; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $uploaderFactoryMock; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $uploaderMock; | ||
|
||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $requestDataMock; | ||
|
||
public function setUp() | ||
{ | ||
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); | ||
$this->uploaderFactoryMock = $this->getMockBuilder('\Magento\MediaStorage\Model\File\UploaderFactory') | ||
->setMethods(['create']) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->uploaderMock = $this->getMockBuilder('\Magento\MediaStorage\Model\File\Uploader') | ||
->setMethods(['setAllowedExtensions', 'save']) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->uploaderFactoryMock | ||
->expects($this->once()) | ||
->method('create') | ||
->will($this->returnValue($this->uploaderMock)); | ||
$this->requestDataMock = $this | ||
->getMockBuilder('\Magento\Config\Model\Config\Backend\File\RequestData\RequestDataInterface') | ||
->setMethods(['getTmpName']) | ||
->getMockForAbstractClass(); | ||
$mediaDirectoryMock = $this->getMockBuilder('\Magento\Framework\Filesystem\Directory\WriteInterface') | ||
->disableOriginalConstructor() | ||
->getMockForAbstractClass(); | ||
$filesystemMock = $this->getMockBuilder('\Magento\Framework\Filesystem') | ||
->disableOriginalConstructor() | ||
->setMethods(['getDirectoryWrite']) | ||
->getMock(); | ||
$filesystemMock->expects($this->once()) | ||
->method('getDirectoryWrite') | ||
->will($this->returnValue($mediaDirectoryMock)); | ||
$this->model = $helper->getObject( | ||
'Magento\Config\Model\Config\Backend\Image\Logo', | ||
[ | ||
'uploaderFactory' => $this->uploaderFactoryMock, | ||
'requestData' => $this->requestDataMock, | ||
'filesystem' => $filesystemMock, | ||
] | ||
); | ||
} | ||
|
||
public function testBeforeSave() | ||
{ | ||
$this->requestDataMock->expects($this->once()) | ||
->method('getTmpName') | ||
->will($this->returnValue('/tmp/val')); | ||
$this->uploaderMock->expects($this->once()) | ||
->method('setAllowedExtensions') | ||
->with($this->equalTo(['jpg', 'jpeg', 'gif', 'png', 'svg'])); | ||
$this->model->beforeSave(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters