Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Accordion;
use Magento\Backend\Block\Widget\Tabs as WigetTabs;
use Magento\Backend\Block\Widget\Tabs as WidgetTabs;
use Magento\Backend\Model\Auth\Session;
use Magento\Catalog\Helper\Catalog;
use Magento\Catalog\Helper\Data;
Expand All @@ -22,7 +22,7 @@
* Admin product edit tabs
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Tabs extends WigetTabs
class Tabs extends WidgetTabs
{
const BASIC_TAB_GROUP_CODE = 'basic';

Expand Down Expand Up @@ -109,7 +109,7 @@ public function __construct(
}

/**
* @return void
* @inheritdoc
*/
protected function _construct()
{
Expand All @@ -119,6 +119,8 @@ protected function _construct()
}

/**
* Get group collection.
*
* @param int $attributeSetId
* @return \Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\Collection
*/
Expand All @@ -131,10 +133,11 @@ public function getGroupCollection($attributeSetId)
}

/**
* @return $this
* @inheritdoc
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
*/
protected function _prepareLayout()
{
Expand Down Expand Up @@ -315,6 +318,8 @@ public function getAttributeTabBlock()
}

/**
* Set attribute tab block.
*
* @param string $attributeTabBlock
* @return $this
*/
Expand All @@ -337,6 +342,8 @@ protected function _translateHtml($html)
}

/**
* Get accordion.
*
* @param string $parentTab
* @return string
*/
Expand Down
16 changes: 9 additions & 7 deletions app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

use Magento\Catalog\Api\Data\ProductExtensionInterface;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\Framework\Api\Data\ImageContentInterface;
use Magento\Framework\Api\ExtensibleDataInterface;
use Magento\Framework\Api\ExtensionAttributesFactory;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\Catalog\Model\Product\Attribute\Source\Status;

/**
* Product Test
Expand Down Expand Up @@ -180,7 +180,7 @@ class ProductTest extends \PHPUnit\Framework\TestCase
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $extensionAttrbutes;
private $extensionAttributes;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check Unit Tests, such variable is already presented in codebase


/**
* @var \PHPUnit_Framework_MockObject_MockObject
Expand All @@ -200,7 +200,7 @@ class ProductTest extends \PHPUnit\Framework\TestCase
/**
* @var ProductExtensionInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $extensionAttributes;
private $productExtAttributes;

/**
* @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject
Expand All @@ -218,7 +218,7 @@ protected function setUp()
\Magento\Framework\Module\Manager::class,
['isEnabled']
);
$this->extensionAttrbutes = $this->getMockBuilder(\Magento\Framework\Api\ExtensionAttributesInterface::class)
$this->extensionAttributes = $this->getMockBuilder(\Magento\Framework\Api\ExtensionAttributesInterface::class)
->setMethods(['getWebsiteIds', 'setWebsiteIds'])
->disableOriginalConstructor()
->getMock();
Expand Down Expand Up @@ -372,13 +372,13 @@ protected function setUp()
$this->mediaConfig = $this->createMock(\Magento\Catalog\Model\Product\Media\Config::class);
$this->eavConfig = $this->createMock(\Magento\Eav\Model\Config::class);

$this->extensionAttributes = $this->getMockBuilder(ProductExtensionInterface::class)
$this->productExtAttributes = $this->getMockBuilder(ProductExtensionInterface::class)
->setMethods(['getStockItem'])
->getMockForAbstractClass();
$this->extensionAttributesFactory
->expects($this->any())
->method('create')
->willReturn($this->extensionAttributes);
->willReturn($this->productExtAttributes);

$this->filterCustomAttribute = $this->createTestProxy(
\Magento\Catalog\Model\FilterProductCustomAttribute::class
Expand Down Expand Up @@ -549,6 +549,7 @@ public function testSetCategoryCollection()

public function testGetCategory()
{
$this->model->setData('category_ids', [10]);
$this->category->expects($this->any())->method('getId')->will($this->returnValue(10));
$this->registry->expects($this->any())->method('registry')->will($this->returnValue($this->category));
$this->categoryRepository->expects($this->any())->method('get')->will($this->returnValue($this->category));
Expand All @@ -557,7 +558,8 @@ public function testGetCategory()

public function testGetCategoryId()
{
$this->category->expects($this->once())->method('getId')->will($this->returnValue(10));
$this->model->setData('category_ids', [10]);
$this->category->expects($this->any())->method('getId')->will($this->returnValue(10));

$this->registry->expects($this->at(0))->method('registry');
$this->registry->expects($this->at(1))->method('registry')->will($this->returnValue($this->category));
Expand Down