Skip to content

Commit

Permalink
Update Framework interfaces and mark as API
Browse files Browse the repository at this point in the history
update


update fix unit tests


update


update
  • Loading branch information
mrtuvn committed Feb 16, 2021
1 parent 517a568 commit 554149f
Show file tree
Hide file tree
Showing 20 changed files with 18 additions and 110 deletions.
8 changes: 0 additions & 8 deletions app/code/Magento/Eav/Model/TypeLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,4 @@ public function getType($attributeCode, $entityType)

return TypeProcessor::NORMALIZED_ANY_TYPE;
}

/**
* {@inheritDoc}
*/
public function getAllServiceDataInterfaces()
{
return $this->serviceTypeList->getDataTypes();
}
}
8 changes: 0 additions & 8 deletions app/code/Magento/Eav/Model/TypeLocator/ComplexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ public function getDataTypes()
return array_unique($dataInterfaceArray);
}

/**
* {@inheritDoc}
*/
public function getAllServiceDataInterfaces()
{
return $this->getDataTypes();
}

/**
* @return array [['backend model' => 'simple or complex type'], ..]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,4 @@ public function getType($attributeCode, $entityType)

return $type;
}

/**
* @inheritDoc
*/
public function getAllServiceDataInterfaces()
{
return $this->complexTypeLocator->getDataTypes();
}
}
10 changes: 0 additions & 10 deletions app/code/Magento/Eav/Model/TypeLocator/SimpleType.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,4 @@ public function getType($attributeCode, $entityType)
];
return $backendTypeMap[$backendType] ?? TypeProcessor::NORMALIZED_ANY_TYPE;
}

/**
* Get data Types from service type list
*
* @return void
*/
public function getAllServiceDataInterfaces()
{
$this->serviceTypeList->getDataTypes();
}
}
17 changes: 1 addition & 16 deletions app/code/Magento/Theme/Model/View/Design.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,6 @@ public function __construct(
$this->objectManager = $objectManager;
}

/**
* Set package area
*
* @param string $area
* @return $this
*/
public function setArea($area)
{
$this->_area = $area;
$this->_theme = null;
return $this;
}

/**
* Retrieve package area
*
Expand All @@ -136,9 +123,7 @@ public function getArea()
*/
public function setDesignTheme($theme, $area = null)
{
if ($area) {
$this->setArea($area);
} else {
if (null === $area) {
$area = $this->getArea();
}

Expand Down
11 changes: 5 additions & 6 deletions app/code/Magento/Theme/Test/Unit/Model/View/DesignTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testGetThemePath($themePath, $themeId, $expectedResult)
/**
* @return array
*/
public function getThemePathDataProvider()
public function getThemePathDataProvider(): array
{
return [
['some_path', '', 'some_path'],
Expand All @@ -115,7 +115,7 @@ public function getThemePathDataProvider()
/**
* @return array
*/
public function designThemeDataProvider()
public function designThemeDataProvider(): array
{
return [
'single' => [true, ScopeInterface::SCOPE_WEBSITES],
Expand All @@ -130,7 +130,7 @@ public function designThemeDataProvider()
* @dataProvider designThemeDataProvider
* @return void
*/
public function testSetDefaultDesignTheme($storeMode, $scope)
public function testSetDefaultDesignTheme($storeMode, $scope): void
{
$area = Design::DEFAULT_AREA;
$this->state->expects($this->any())
Expand All @@ -157,7 +157,7 @@ public function testSetDefaultDesignTheme($storeMode, $scope)
* @covers \Magento\Theme\Model\View\Design::getArea
* @covers \Magento\Theme\Model\View\Design::getDesignTheme
*/
public function testGetDesignParams()
public function testGetDesignParams(): void
{
$locale = 'locale';
$area = Design::DEFAULT_AREA;
Expand Down Expand Up @@ -187,9 +187,8 @@ public function testGetDesignParams()
* @test
* @return void
* @covers \Magento\Theme\Model\View\Design::setDesignTheme
* @covers \Magento\Theme\Model\View\Design::setArea
*/
public function testSetDesignTheme()
public function testSetDesignTheme(): void
{
$area = 'adminhtml';
$theme = $this->getMockBuilder(ThemeInterface::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public function testPrepareForm()
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$objectManager->get(
\Magento\Framework\View\DesignInterface::class
)->setArea(
\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE
)->setDefaultDesignTheme();
$objectManager->get(
\Magento\Framework\Registry::class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public function testSetFieldset()
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$objectManager->get(
\Magento\Framework\View\DesignInterface::class
)->setArea(
\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE
)->setDefaultDesignTheme();
$layout = $objectManager->create(\Magento\Framework\View\Layout::class);
$formBlock = $layout->addBlock(\Magento\Backend\Block\Widget\Form::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

$objectManager->get(
\Magento\Framework\View\DesignInterface::class
)->setArea(
'frontend'
)->setDefaultDesignTheme();

/** @var \Magento\Catalog\Model\Product\Media\Config $config */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public function testPrepareForm()
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();

$objectManager->get(\Magento\Framework\View\DesignInterface::class)
->setArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE)
->setDefaultDesignTheme();

$block = $objectManager->get(\Magento\Framework\View\LayoutInterface::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public function testInitDesign()
)->getArea();
$sameDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Framework\View\DesignInterface::class
)->setArea(
$designArea
);
$this->assertSame($design, $sameDesign);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public function testPrepareForm()

$objectManager->get(
\Magento\Framework\View\DesignInterface::class
)->setArea(
\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE
)->setDefaultDesignTheme();
$objectManager->get(
\Magento\Framework\Config\ScopeInterface::class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public function testPrepareForm()
{
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Framework\View\DesignInterface::class
)->setArea(
\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE
)->setDefaultDesignTheme();
$layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Framework\View\Layout::class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Theme\Model\View;

use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Store\Model\ScopeInterface;
use PHPUnit\Framework\TestCase;

/**
* @magentoComponentsDir Magento/Theme/Model/_files/design
* @magentoDbIsolation enabled
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class DesignTest extends \PHPUnit\Framework\TestCase
class DesignTest extends TestCase
{
/**
* @var \Magento\Framework\View\DesignInterface
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/App/Area.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ protected function _initTranslate()
*/
protected function _initDesign()
{
$this->_getDesign()->setArea($this->_code)->setDefaultDesignTheme();
$this->_getDesign()->setDefaultDesignTheme();
return $this;
}
}
4 changes: 1 addition & 3 deletions lib/internal/Magento/Framework/App/Config/ValueInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
/**
* Interface \Magento\Framework\App\Config\ValueInterface
*
* This interface cannot be marked as API since doesn't fit developers' needs of extensibility. In 2.4 we are going
* to introduce a new interface which should cover all needs and deprecate the this one with the model
* {@see \Magento\Framework\App\Config\Value}
* @api
*/
interface ValueInterface
{
Expand Down
8 changes: 0 additions & 8 deletions lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ public function testLoadDesign()
->method('get')
->with(\Magento\Framework\View\DesignInterface::class)
->willReturn($designMock);
$designMock->expects($this->once())
->method('setArea')
->with($this->areaCode)
->willReturnSelf();
$designMock->expects($this->once())
->method('setDefaultDesignTheme');
$this->object->load(Area::PART_DESIGN);
Expand All @@ -207,10 +203,6 @@ public function testLoad()
$designMock = $this->getMockBuilder(\Magento\Framework\View\DesignInterface::class)
->disableOriginalConstructor()
->getMock();
$designMock->expects($this->once())
->method('setArea')
->with($this->areaCode)
->willReturnSelf();
$designMock->expects($this->once())
->method('setDefaultDesignTheme');
$this->objectManagerMock->expects($this->exactly(2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Configuration for the consumer.
*
* @api
*/
interface ConsumerConfigurationInterface
{
Expand Down Expand Up @@ -41,16 +43,6 @@ public function getConsumerName();
*/
public function getQueueName();

/**
* Get consumer type sync|async.
*
* @return string
* @deprecated 103.0.0
* @see \Magento\Framework\Communication\ConfigInterface::getTopic
* @throws \LogicException
*/
public function getType();

/**
* Get maximum number of message, which will be read by consumer before termination of the process.
*
Expand Down
11 changes: 2 additions & 9 deletions lib/internal/Magento/Framework/View/DesignInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Design Interface
*
* @api
*/
interface DesignInterface
{
Expand All @@ -27,15 +29,6 @@ interface DesignInterface
*/
const XML_PATH_THEME_ID = 'design/theme/theme_id';

/**
* Set package area
*
* @param string $area
* @return DesignInterface
* @TODO MAGETWO-31474: Remove deprecated method setArea
*/
public function setArea($area);

/**
* Retrieve package area
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* Interface to locate types for custom attributes
*
* @api
*/
interface CustomAttributeTypeLocatorInterface
{
Expand All @@ -19,13 +21,4 @@ interface CustomAttributeTypeLocatorInterface
* @return string
*/
public function getType($attributeCode, $entityType);

/**
* Get list of all Data Interface corresponding to complex custom attribute types
*
* @return string[] array of Data Interface class names
* @deprecated 102.0.0
* @see \Magento\Framework\Webapi\CustomAttribute\ServiceTypeListInterface::getDataTypes()
*/
public function getAllServiceDataInterfaces();
}

0 comments on commit 554149f

Please sign in to comment.