-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 #74 from magento-folks/bugfix
[Folks] Bugfix
- Loading branch information
Showing
22 changed files
with
752 additions
and
92 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
49 changes: 49 additions & 0 deletions
49
app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/BooleanTest.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,49 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Test\Unit\Model\Product\Attribute\Backend; | ||
|
||
use Magento\Catalog\Model\Product\Attribute\Backend\Boolean as BooleanBackend; | ||
use Magento\Catalog\Model\Product\Attribute\Source\Boolean as BooleanSource; | ||
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; | ||
use Magento\Framework\DataObject; | ||
|
||
class BooleanTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject|AbstractAttribute | ||
*/ | ||
private $attributeMock; | ||
|
||
/** | ||
* @var BooleanBackend | ||
*/ | ||
private $model; | ||
|
||
protected function setUp() | ||
{ | ||
$this->attributeMock = $this->getMockForAbstractClass( | ||
AbstractAttribute::class, | ||
[], | ||
'', | ||
false, | ||
true, | ||
true, | ||
['getName'] | ||
); | ||
$this->model = new BooleanBackend(); | ||
$this->model->setAttribute($this->attributeMock); | ||
} | ||
|
||
public function testBeforeSave() | ||
{ | ||
$this->attributeMock->expects($this->any())->method('getName')->willReturn('attribute_name'); | ||
$object = new DataObject([ | ||
'use_config_attribute_name' => true, | ||
]); | ||
$this->model->beforeSave($object); | ||
$this->assertEquals(BooleanSource::VALUE_USE_CONFIG, $object->getData('attribute_name')); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Source/BooleanTest.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,43 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Test\Unit\Model\Product\Attribute\Source; | ||
|
||
use Magento\Catalog\Model\Product\Attribute\Source\Boolean as BooleanSource; | ||
|
||
class BooleanTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $attributeFactoryMock; | ||
|
||
/** | ||
* @var BooleanSource | ||
*/ | ||
private $model; | ||
|
||
protected function setUp() | ||
{ | ||
$this->attributeFactoryMock = $this->getMock( | ||
'Magento\Eav\Model\ResourceModel\Entity\AttributeFactory', | ||
[], | ||
[], | ||
'', | ||
false | ||
); | ||
$this->model = new BooleanSource($this->attributeFactoryMock); | ||
} | ||
|
||
public function testGetAllOptions() | ||
{ | ||
$expectedResult = [ | ||
['label' => __('Yes'), 'value' => BooleanSource::VALUE_YES], | ||
['label' => __('No'), 'value' => BooleanSource::VALUE_NO], | ||
['label' => __('Use config'), 'value' => BooleanSource::VALUE_USE_CONFIG], | ||
]; | ||
$this->assertEquals($expectedResult, $this->model->getAllOptions()); | ||
} | ||
} |
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
Oops, something went wrong.