-
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 #714 from magento-tango/new_pr_bugs
[Tango] Bug Fixes
- Loading branch information
Showing
25 changed files
with
994 additions
and
164 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
107 changes: 107 additions & 0 deletions
107
...code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/AbstractRendererTest.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,107 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Backend\Test\Unit\Block\Widget\Grid\Column\Renderer; | ||
|
||
class AbstractRendererTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \Magento\Backend\Block\Widget\Grid\Column|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected $columnMock; | ||
|
||
/** | ||
* @var \Magento\Framework\DataObject|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected $dataObjectMock; | ||
|
||
/** | ||
* @var \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer | ||
*/ | ||
protected $renderer; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->dataObjectMock = $this->getMock('Magento\Framework\DataObject', ['getData'], [], '', false); | ||
$this->columnMock = $this->getMockBuilder('Magento\Backend\Block\Widget\Grid\Column') | ||
->disableOriginalConstructor() | ||
->setMethods(['getEditable', 'getIndex', 'getEditOnly', 'getId']) | ||
->getMock(); | ||
$this->renderer = $this->getMockBuilder('Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer') | ||
->disableOriginalConstructor() | ||
->setMethods(null) | ||
->getMock(); | ||
} | ||
|
||
/** | ||
* @param bool $editable | ||
* @param bool $onlyEdit | ||
* @param string $expectedResult | ||
* @return void | ||
* @dataProvider renderDataProvider | ||
*/ | ||
public function testRender($editable, $onlyEdit, $expectedResult) | ||
{ | ||
$value = 'some value'; | ||
$keyValue = 'key'; | ||
|
||
$this->columnMock->expects($this->once()) | ||
->method('getEditable') | ||
->willReturn($editable); | ||
$this->columnMock->expects($this->any()) | ||
->method('getEditOnly') | ||
->willReturn($onlyEdit); | ||
$this->columnMock->expects($this->any()) | ||
->method('getIndex') | ||
->willReturn($keyValue); | ||
$this->columnMock->expects($this->any()) | ||
->method('getId') | ||
->willReturn('test'); | ||
$this->dataObjectMock->expects($this->any()) | ||
->method('getData') | ||
->with($keyValue) | ||
->willReturn($value); | ||
$this->renderer->setColumn($this->columnMock); | ||
|
||
$this->assertEquals($expectedResult, $this->renderer->render($this->dataObjectMock)); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function renderDataProvider() | ||
{ | ||
return [ | ||
[ | ||
'editable' => false, | ||
'onlyEdit' => false, | ||
'expectedResult' => 'some value' | ||
], | ||
[ | ||
'editable' => false, | ||
'onlyEdit' => true, | ||
'expectedResult' => 'some value' | ||
], | ||
[ | ||
'editable' => true, | ||
'onlyEdit' => false, | ||
'expectedResult' => '<div class="admin__grid-control">' | ||
. '<span class="admin__grid-control-value">some value</span>' | ||
. '<input type="text" class="input-text " name="test" value="some value"/>' | ||
. '</div>' | ||
], | ||
[ | ||
'editable' => true, | ||
'onlyEdit' => true, | ||
'expectedResult' => '<div class="admin__grid-control">' | ||
. '<input type="text" class="input-text " name="test" value="some value"/>' | ||
. '</div>' | ||
], | ||
]; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Cms\Model\Page\Source; | ||
|
||
/** | ||
* Is active filter source | ||
*/ | ||
class IsActiveFilter extends IsActive | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function toOptionArray() | ||
{ | ||
return array_merge([['label' => '', 'value' => '']], parent::toOptionArray()); | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
app/code/Magento/Cms/Model/Page/Source/PageLayoutFilter.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,20 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Cms\Model\Page\Source; | ||
|
||
/** | ||
* Page layout filter source | ||
*/ | ||
class PageLayoutFilter extends PageLayout | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function toOptionArray() | ||
{ | ||
return array_merge([['label' => '', 'value' => '']], parent::toOptionArray()); | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Cms\Model\Page\Source; | ||
|
||
/** | ||
* Theme filter source | ||
*/ | ||
class ThemeFilter extends Theme | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function toOptionArray() | ||
{ | ||
return array_merge([['label' => '', 'value' => '']], parent::toOptionArray()); | ||
} | ||
} |
Oops, something went wrong.