From 554149f0f31273c9e2ef50a3a8d7c49d138c188b Mon Sep 17 00:00:00 2001 From: TuNa Date: Tue, 16 Feb 2021 10:31:49 +0700 Subject: [PATCH] Update Framework interfaces and mark as API update update fix unit tests update update --- app/code/Magento/Eav/Model/TypeLocator.php | 8 -------- .../Eav/Model/TypeLocator/ComplexType.php | 8 -------- .../Model/TypeLocator/ServiceClassLocator.php | 8 -------- .../Eav/Model/TypeLocator/SimpleType.php | 10 ---------- app/code/Magento/Theme/Model/View/Design.php | 17 +---------------- .../Theme/Test/Unit/Model/View/DesignTest.php | 11 +++++------ .../System/Design/Edit/Tab/GeneralTest.php | 2 -- .../Magento/Backend/Block/Widget/FormTest.php | 2 -- .../Catalog/controllers/_files/products.php | 2 -- .../Block/Adminhtml/Crypt/Key/FormTest.php | 1 - .../Magento/Framework/App/AreaTest.php | 2 -- .../Block/Adminhtml/Queue/Edit/FormTest.php | 2 -- .../Reports/Block/Adminhtml/Filter/FormTest.php | 2 -- .../Magento/Theme/Model/View/DesignTest.php | 5 ++++- lib/internal/Magento/Framework/App/Area.php | 2 +- .../Framework/App/Config/ValueInterface.php | 4 +--- .../Framework/App/Test/Unit/AreaTest.php | 8 -------- .../ConsumerConfigurationInterface.php | 12 ++---------- .../Magento/Framework/View/DesignInterface.php | 11 ++--------- .../CustomAttributeTypeLocatorInterface.php | 11 ++--------- 20 files changed, 18 insertions(+), 110 deletions(-) diff --git a/app/code/Magento/Eav/Model/TypeLocator.php b/app/code/Magento/Eav/Model/TypeLocator.php index 76c03ff69ae05..3eb6e3fd763ca 100644 --- a/app/code/Magento/Eav/Model/TypeLocator.php +++ b/app/code/Magento/Eav/Model/TypeLocator.php @@ -53,12 +53,4 @@ public function getType($attributeCode, $entityType) return TypeProcessor::NORMALIZED_ANY_TYPE; } - - /** - * {@inheritDoc} - */ - public function getAllServiceDataInterfaces() - { - return $this->serviceTypeList->getDataTypes(); - } } diff --git a/app/code/Magento/Eav/Model/TypeLocator/ComplexType.php b/app/code/Magento/Eav/Model/TypeLocator/ComplexType.php index c01779e27aa03..6c168af6afe58 100644 --- a/app/code/Magento/Eav/Model/TypeLocator/ComplexType.php +++ b/app/code/Magento/Eav/Model/TypeLocator/ComplexType.php @@ -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'], ..] */ diff --git a/app/code/Magento/Eav/Model/TypeLocator/ServiceClassLocator.php b/app/code/Magento/Eav/Model/TypeLocator/ServiceClassLocator.php index 7ffcf689c4381..e51c597e3d19d 100644 --- a/app/code/Magento/Eav/Model/TypeLocator/ServiceClassLocator.php +++ b/app/code/Magento/Eav/Model/TypeLocator/ServiceClassLocator.php @@ -73,12 +73,4 @@ public function getType($attributeCode, $entityType) return $type; } - - /** - * @inheritDoc - */ - public function getAllServiceDataInterfaces() - { - return $this->complexTypeLocator->getDataTypes(); - } } diff --git a/app/code/Magento/Eav/Model/TypeLocator/SimpleType.php b/app/code/Magento/Eav/Model/TypeLocator/SimpleType.php index eb9b173ed52be..855c52789504b 100644 --- a/app/code/Magento/Eav/Model/TypeLocator/SimpleType.php +++ b/app/code/Magento/Eav/Model/TypeLocator/SimpleType.php @@ -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(); - } } diff --git a/app/code/Magento/Theme/Model/View/Design.php b/app/code/Magento/Theme/Model/View/Design.php index 98f7665400dd8..3002cfcba344f 100644 --- a/app/code/Magento/Theme/Model/View/Design.php +++ b/app/code/Magento/Theme/Model/View/Design.php @@ -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 * @@ -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(); } diff --git a/app/code/Magento/Theme/Test/Unit/Model/View/DesignTest.php b/app/code/Magento/Theme/Test/Unit/Model/View/DesignTest.php index 12ddea6fd7f40..8e80fd929526c 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/View/DesignTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/View/DesignTest.php @@ -103,7 +103,7 @@ public function testGetThemePath($themePath, $themeId, $expectedResult) /** * @return array */ - public function getThemePathDataProvider() + public function getThemePathDataProvider(): array { return [ ['some_path', '', 'some_path'], @@ -115,7 +115,7 @@ public function getThemePathDataProvider() /** * @return array */ - public function designThemeDataProvider() + public function designThemeDataProvider(): array { return [ 'single' => [true, ScopeInterface::SCOPE_WEBSITES], @@ -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()) @@ -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; @@ -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) diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php index ff7fda4f75eee..6fe65034ae099 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php @@ -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 diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php index f9f8bc7fb0a86..c816a9e119b0c 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php @@ -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); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php index 4a3c8f2e6b96c..09d7340405b08 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php @@ -12,8 +12,6 @@ $objectManager->get( \Magento\Framework\View\DesignInterface::class -)->setArea( - 'frontend' )->setDefaultDesignTheme(); /** @var \Magento\Catalog\Model\Product\Media\Config $config */ diff --git a/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/FormTest.php b/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/FormTest.php index 8f6ac72e4a6a2..c17e092cbf1e9 100644 --- a/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/FormTest.php @@ -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) diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/AreaTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/AreaTest.php index 575caf6e3e991..31477734349b0 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/AreaTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/AreaTest.php @@ -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); } diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php index df50f80f4ea66..d749a3568de53 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/Queue/Edit/FormTest.php @@ -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 diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php index 62ab380e55983..afa2dd4d2a48b 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php @@ -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 diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php index 3e651a90d1fc5..99b8ae51f5c1b 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php @@ -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 diff --git a/lib/internal/Magento/Framework/App/Area.php b/lib/internal/Magento/Framework/App/Area.php index 4bc7c769caf19..c976bf5d3f0d3 100644 --- a/lib/internal/Magento/Framework/App/Area.php +++ b/lib/internal/Magento/Framework/App/Area.php @@ -258,7 +258,7 @@ protected function _initTranslate() */ protected function _initDesign() { - $this->_getDesign()->setArea($this->_code)->setDefaultDesignTheme(); + $this->_getDesign()->setDefaultDesignTheme(); return $this; } } diff --git a/lib/internal/Magento/Framework/App/Config/ValueInterface.php b/lib/internal/Magento/Framework/App/Config/ValueInterface.php index 0aa600b84dcce..b7fcf7c221ef2 100644 --- a/lib/internal/Magento/Framework/App/Config/ValueInterface.php +++ b/lib/internal/Magento/Framework/App/Config/ValueInterface.php @@ -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 { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php b/lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php index 0b0e409e6439d..cf2ae67812ffa 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/AreaTest.php @@ -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); @@ -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)) diff --git a/lib/internal/Magento/Framework/MessageQueue/ConsumerConfigurationInterface.php b/lib/internal/Magento/Framework/MessageQueue/ConsumerConfigurationInterface.php index 3e54f03e71603..d320cd660f1bd 100644 --- a/lib/internal/Magento/Framework/MessageQueue/ConsumerConfigurationInterface.php +++ b/lib/internal/Magento/Framework/MessageQueue/ConsumerConfigurationInterface.php @@ -7,6 +7,8 @@ /** * Configuration for the consumer. + * + * @api */ interface ConsumerConfigurationInterface { @@ -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. * diff --git a/lib/internal/Magento/Framework/View/DesignInterface.php b/lib/internal/Magento/Framework/View/DesignInterface.php index ee501f1f494ad..9a98ab6d3d876 100644 --- a/lib/internal/Magento/Framework/View/DesignInterface.php +++ b/lib/internal/Magento/Framework/View/DesignInterface.php @@ -7,6 +7,8 @@ /** * Design Interface + * + * @api */ interface DesignInterface { @@ -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 * diff --git a/lib/internal/Magento/Framework/Webapi/CustomAttributeTypeLocatorInterface.php b/lib/internal/Magento/Framework/Webapi/CustomAttributeTypeLocatorInterface.php index ac183bc3b1871..44608efc4a738 100644 --- a/lib/internal/Magento/Framework/Webapi/CustomAttributeTypeLocatorInterface.php +++ b/lib/internal/Magento/Framework/Webapi/CustomAttributeTypeLocatorInterface.php @@ -8,6 +8,8 @@ /** * Interface to locate types for custom attributes + * + * @api */ interface CustomAttributeTypeLocatorInterface { @@ -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(); }