getUnreadMessages() as $message): ?>
- -
- getText();?>
+
-
+ = /* @escapeNotVerified */ $message->getText() ?>
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml
index dea873ec3dde8..777448cdd82b4 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml
+++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml
@@ -15,70 +15,70 @@
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/columns/message.js b/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/columns/message.js
index d7099f2f2b606..6c67f7463d9d3 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/columns/message.js
+++ b/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/columns/message.js
@@ -2,6 +2,10 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
+/**
+ * @api
+ */
define([
'Magento_Ui/js/grid/columns/column',
'underscore'
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/listing.js b/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/listing.js
index de33f674aa783..71512cfa395e0 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/listing.js
+++ b/app/code/Magento/AdminNotification/view/adminhtml/web/js/grid/listing.js
@@ -3,6 +3,9 @@
* See COPYING.txt for license details.
*/
+/**
+ * @api
+ */
define([
'Magento_Ui/js/grid/listing',
'Magento_Ui/js/lib/spinner',
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js b/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js
index 57f0a103c7888..c464ecb3e3a8c 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js
+++ b/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js
@@ -3,6 +3,9 @@
* See COPYING.txt for license details.
*/
+/**
+ * @api
+ */
define([
'jquery',
'mage/template',
diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js b/app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js
index 9528e1442d1cc..4131cfa9ef0f0 100644
--- a/app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js
+++ b/app/code/Magento/AdminNotification/view/adminhtml/web/toolbar_entry.js
@@ -3,6 +3,9 @@
* See COPYING.txt for license details.
*/
+/**
+ * @api
+ */
define([
'jquery',
'jquery/ui',
diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php
index 8c404cdaf62b3..48b4c58918740 100644
--- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php
+++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php
@@ -5,12 +5,12 @@
*/
namespace Magento\AdvancedPricingImportExport\Test\Unit\Model\Export;
-use \Magento\Store\Model\Store;
+use Magento\Store\Model\Store;
/**
* @SuppressWarnings(PHPMD)
*/
-class AdvancedPricingTest extends \PHPUnit_Framework_TestCase
+class AdvancedPricingTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Stdlib\DateTime\Timezone|\PHPUnit_Framework_MockObject_MockObject
@@ -127,56 +127,14 @@ class AdvancedPricingTest extends \PHPUnit_Framework_TestCase
*/
protected function setUp()
{
- $this->localeDate = $this->getMock(
- \Magento\Framework\Stdlib\DateTime\Timezone::class,
- [],
- [],
- '',
- false
- );
- $this->config = $this->getMock(
- \Magento\Eav\Model\Config::class,
- ['getEntityType'],
- [],
- '',
- false
- );
- $type = $this->getMock(
- \Magento\Eav\Model\Entity\Type::class,
- [],
- [],
- '',
- false
- );
+ $this->localeDate = $this->createMock(\Magento\Framework\Stdlib\DateTime\Timezone::class);
+ $this->config = $this->createPartialMock(\Magento\Eav\Model\Config::class, ['getEntityType']);
+ $type = $this->createMock(\Magento\Eav\Model\Entity\Type::class);
$this->config->expects($this->once())->method('getEntityType')->willReturn($type);
- $this->resource = $this->getMock(
- \Magento\Framework\App\ResourceConnection::class,
- [],
- [],
- '',
- false
- );
- $this->storeManager = $this->getMock(
- \Magento\Store\Model\StoreManager::class,
- [],
- [],
- '',
- false
- );
- $this->logger = $this->getMock(
- \Magento\Framework\Logger\Monolog::class,
- [],
- [],
- '',
- false
- );
- $this->collection = $this->getMock(
- \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class,
- [],
- [],
- '',
- false
- );
+ $this->resource = $this->createMock(\Magento\Framework\App\ResourceConnection::class);
+ $this->storeManager = $this->createMock(\Magento\Store\Model\StoreManager::class);
+ $this->logger = $this->createMock(\Magento\Framework\Logger\Monolog::class);
+ $this->collection = $this->createMock(\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class);
$this->abstractCollection = $this->getMockForAbstractClass(
\Magento\Eav\Model\Entity\Collection\AbstractCollection::class,
[],
@@ -192,110 +150,46 @@ protected function setUp()
'getLastPageNumber',
]
);
- $this->exportConfig = $this->getMock(
- \Magento\ImportExport\Model\Export\Config::class,
- [],
- [],
- '',
- false
- );
- $this->productFactory = $this->getMock(
- \Magento\Catalog\Model\ResourceModel\ProductFactory::class,
- [
+ $this->exportConfig = $this->createMock(\Magento\ImportExport\Model\Export\Config::class);
+ $this->productFactory = $this->createPartialMock(\Magento\Catalog\Model\ResourceModel\ProductFactory::class, [
'create',
'getTypeId',
- ],
- [],
- '',
- false
- );
- $this->attrSetColFactory = $this->getMock(
+ ]);
+ $this->attrSetColFactory = $this->createPartialMock(
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory::class,
[
'create',
'setEntityTypeFilter',
- ],
- [],
- '',
- false
+ ]
);
- $this->categoryColFactory = $this->getMock(
+ $this->categoryColFactory = $this->createPartialMock(
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory::class,
[
'create',
'addNameToResult',
- ],
- [],
- '',
- false
- );
- $this->itemFactory = $this->getMock(
- \Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory::class,
- [],
- [],
- '',
- false
- );
- $this->optionColFactory = $this->getMock(
- \Magento\Catalog\Model\ResourceModel\Product\Option\CollectionFactory::class,
- [],
- [],
- '',
- false
- );
- $this->attributeColFactory = $this->getMock(
- \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory::class,
- [],
- [],
- '',
- false
- );
- $this->typeFactory = $this->getMock(
- \Magento\CatalogImportExport\Model\Export\Product\Type\Factory::class,
- [],
- [],
- '',
- false
+ ]
);
- $this->linkTypeProvider = $this->getMock(
- \Magento\Catalog\Model\Product\LinkTypeProvider::class,
- [],
- [],
- '',
- false
+ $this->itemFactory = $this->createMock(\Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory::class);
+ $this->optionColFactory = $this->createMock(
+ \Magento\Catalog\Model\ResourceModel\Product\Option\CollectionFactory::class
);
- $this->rowCustomizer = $this->getMock(
- \Magento\CatalogImportExport\Model\Export\RowCustomizer\Composite::class,
- [],
- [],
- '',
- false
+ $this->attributeColFactory = $this->createMock(
+ \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory::class
);
- $this->storeResolver = $this->getMock(
- \Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class,
- [],
- [],
- '',
- false
+ $this->typeFactory = $this->createMock(\Magento\CatalogImportExport\Model\Export\Product\Type\Factory::class);
+ $this->linkTypeProvider = $this->createMock(\Magento\Catalog\Model\Product\LinkTypeProvider::class);
+ $this->rowCustomizer = $this->createMock(
+ \Magento\CatalogImportExport\Model\Export\RowCustomizer\Composite::class
);
- $this->groupRepository = $this->getMock(
- \Magento\Customer\Api\GroupRepositoryInterface::class,
- [],
- [],
- '',
- false
+ $this->storeResolver = $this->createMock(
+ \Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class
);
- $this->writer = $this->getMock(
- \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter::class,
- [
+ $this->groupRepository = $this->createMock(\Magento\Customer\Api\GroupRepositoryInterface::class);
+ $this->writer = $this->createPartialMock(\Magento\ImportExport\Model\Export\Adapter\AbstractAdapter::class, [
'setHeaderCols',
'writeRow',
'getContents',
- ],
- [],
- '',
- false
- );
+ ]);
$constructorMethods = [
'initTypeModels',
'initAttributes',
@@ -315,14 +209,16 @@ protected function setUp()
'getItemsPerPage',
'paginateCollection',
'_getHeaderColumns',
+ '_getWebsiteCode',
+ '_getCustomerGroupById',
+ 'correctExportData'
]);
- $this->advancedPricing = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing::class,
- $mockMethods,
- [],
- '',
- false
- );
+ $this->advancedPricing = $this->getMockbuilder(
+ \Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing::class
+ )
+ ->setMethods($mockMethods)
+ ->disableOriginalConstructor()
+ ->getMock();
foreach ($constructorMethods as $method) {
$this->advancedPricing->expects($this->once())->method($method)->will($this->returnSelf());
}
diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php
index 7fe9453273a2b..bb64acb558320 100644
--- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php
+++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php
@@ -6,12 +6,12 @@
namespace Magento\AdvancedPricingImportExport\Test\Unit\Model\Import\AdvancedPricing\Validator;
-use \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing as AdvancedPricing;
+use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing as AdvancedPricing;
/**
* @SuppressWarnings(PHPMD)
*/
-class TierPriceTest extends \PHPUnit_Framework_TestCase
+class TierPriceTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Customer\Api\GroupRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject
@@ -40,36 +40,22 @@ protected function setUp()
->setMethods(['getList'])
->getMockForAbstractClass();
- $this->searchCriteriaBuilder = $this->getMock(
- \Magento\Framework\Api\SearchCriteriaBuilder::class,
- [],
- [],
- '',
- false
- );
- $this->storeResolver = $this->getMock(
- \Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class,
- [],
- [],
- '',
- false
+ $this->searchCriteriaBuilder = $this->createMock(\Magento\Framework\Api\SearchCriteriaBuilder::class);
+ $this->storeResolver = $this->createMock(
+ \Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class
);
- $this->tierPrice = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TierPrice::class,
- ['isValidValueAndLength', 'hasEmptyColumns', '_addMessages'],
- [
- $this->groupRepository,
- $this->searchCriteriaBuilder,
- $this->storeResolver,
- ],
- ''
- );
+ $this->tierPrice = $this->getMockBuilder(
+ \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TierPrice::class
+ )
+ ->setMethods(['isValidValueAndLength', 'hasEmptyColumns', '_addMessages'])
+ ->setConstructorArgs([$this->groupRepository, $this->searchCriteriaBuilder, $this->storeResolver])
+ ->getMock();
}
public function testInitInternalCalls()
{
- $searchCriteria = $this->getMock(\Magento\Framework\Api\SearchCriteria::class, [], [], '', false);
+ $searchCriteria = $this->createMock(\Magento\Framework\Api\SearchCriteria::class);
$this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($searchCriteria);
$groupSearchResult = $this->getMockForAbstractClass(
\Magento\Customer\Api\Data\GroupSearchResultsInterface::class,
@@ -97,7 +83,7 @@ public function testInitInternalCalls()
public function testInitAddToCustomerGroups()
{
- $searchCriteria = $this->getMock(\Magento\Framework\Api\SearchCriteria::class, [], [], '', false);
+ $searchCriteria = $this->createMock(\Magento\Framework\Api\SearchCriteria::class);
$this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($searchCriteria);
$groupSearchResult = $this->getMockForAbstractClass(
\Magento\Customer\Api\Data\GroupSearchResultsInterface::class,
@@ -150,27 +136,25 @@ public function testIsValidResultTrue()
*/
public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGroups, $expectedMessages)
{
- $priceContextMock = $this->getMock(
- \Magento\CatalogImportExport\Model\Import\Product::class,
- [],
- [
- \Magento\Framework\Json\Helper\Data::class,
- \Magento\ImportExport\Helper\Data::class,
- \Magento\ImportExport\Model\ResourceModel\Import\Data::class,
- \Magento\Eav\Model\Config::class, \Magento\Framework\App\ResourceConnection::class,
- \Magento\ImportExport\Model\ResourceModel\Helper::class,
- \Magento\Framework\Stdlib\StringUtils::class,
- 'ProcessingErrorAggregatorInterface',
- ],
- '',
- false
- );
+ $priceContextMock = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Product::class)
+ ->setConstructorArgs(
+ [
+ \Magento\Framework\Json\Helper\Data::class,
+ \Magento\ImportExport\Helper\Data::class,
+ \Magento\ImportExport\Model\ResourceModel\Import\Data::class,
+ \Magento\Eav\Model\Config::class,
+ \Magento\Framework\App\ResourceConnection::class,
+ \Magento\ImportExport\Model\ResourceModel\Helper::class,
+ \Magento\Framework\Stdlib\StringUtils::class,
+ 'ProcessingErrorAggregatorInterface'
+ ]
+ );
$this->tierPrice->expects($this->once())->method('isValidValueAndLength')->willReturn(true);
$this->tierPrice->expects($this->any())->method('hasEmptyColumns')->willReturn($hasEmptyColumns);
$this->setPropertyValue($this->tierPrice, 'customerGroups', $customerGroups);
- $searchCriteria = $this->getMock(\Magento\Framework\Api\SearchCriteria::class, [], [], '', false);
+ $searchCriteria = $this->createMock(\Magento\Framework\Api\SearchCriteria::class);
$this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($searchCriteria);
$groupSearchResult = $this->getMockForAbstractClass(
\Magento\Customer\Api\Data\GroupSearchResultsInterface::class,
diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTypeTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTypeTest.php
index 5660d32f051cc..0dc2a0b7e6ddf 100644
--- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTypeTest.php
+++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTypeTest.php
@@ -11,7 +11,7 @@
/**
* Class TierPriceTypeTest.
*/
-class TierPriceTypeTest extends \PHPUnit_Framework_TestCase
+class TierPriceTypeTest extends \PHPUnit\Framework\TestCase
{
/**
* @var AdvancedPricing\Validator\TierPriceType
diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php
index def602c853206..5111b4932d7a8 100644
--- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php
+++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php
@@ -8,7 +8,7 @@
use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing as AdvancedPricing;
-class WebsiteTest extends \PHPUnit_Framework_TestCase
+class WebsiteTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Store\Model\WebSite|\PHPUnit_Framework_MockObject_MockObject
@@ -27,30 +27,21 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->webSiteModel = $this->getMock(
- \Magento\Store\Model\WebSite::class,
- ['getBaseCurrency'],
- [],
- '',
- false
- );
- $this->storeResolver = $this->getMock(
+ $this->webSiteModel = $this->getMockBuilder(\Magento\Store\Model\WebSite::class)
+ ->setMethods(['getBaseCurrency'])
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->storeResolver = $this->createPartialMock(
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class,
- ['getWebsiteCodeToId'],
- [],
- '',
- false
+ ['getWebsiteCodeToId']
);
- $this->website = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\Website::class,
- ['getAllWebsitesValue', '_clearMessages', '_addMessages'],
- [
- $this->storeResolver,
- $this->webSiteModel,
- ],
- ''
- );
+ $this->website = $this->getMockBuilder(
+ \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\Website::class
+ )
+ ->setMethods(['getAllWebsitesValue', '_clearMessages', '_addMessages'])
+ ->setConstructorArgs([$this->storeResolver, $this->webSiteModel])
+ ->getMock();
}
public function testInit()
@@ -106,24 +97,20 @@ public function testIsValidReturnAddMessagesCall()
public function testGetAllWebsitesValue()
{
$currencyCode = 'currencyCodeValue';
- $currency = $this->getMock(\Magento\Directory\Model\Currency::class, ['getCurrencyCode'], [], '', false);
+ $currency = $this->createPartialMock(\Magento\Directory\Model\Currency::class, ['getCurrencyCode']);
$currency->expects($this->once())->method('getCurrencyCode')->willReturn($currencyCode);
$this->webSiteModel->expects($this->once())->method('getBaseCurrency')->willReturn($currency);
$expectedResult = AdvancedPricing::VALUE_ALL_WEBSITES . ' [' . $currencyCode . ']';
+ $this->websiteString = $this->getMockBuilder(
+ \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\Website::class
+ )
+ ->setMethods(['_clearMessages', '_addMessages'])
+ ->setConstructorArgs([$this->storeResolver, $this->webSiteModel])
+ ->getMock();
+ $result = $this->websiteString->getAllWebsitesValue();
- $website = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\Website::class,
- null,
- [
- $this->storeResolver,
- $this->webSiteModel,
- ],
- ''
- );
-
- $result = $website->getAllWebsitesValue();
$this->assertEquals($expectedResult, $result);
}
diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php
index c396818a5094d..d9fce98826105 100644
--- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php
+++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php
@@ -5,10 +5,10 @@
*/
namespace Magento\AdvancedPricingImportExport\Test\Unit\Model\Import\AdvancedPricing;
-use \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator as Validator;
-use \Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as RowValidatorInterface;
+use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator as Validator;
+use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as RowValidatorInterface;
-class ValidatorTest extends \PHPUnit_Framework_TestCase
+class ValidatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Validator |\PHPUnit_Framework_MockObject_MockObject
@@ -37,11 +37,12 @@ protected function setUp()
$this->validatorTest->expects($this->any())->method('getMessages')->willReturn($messages);
$this->validators = [$this->validatorTest];
- $this->validator = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator::class,
- ['_clearMessages', '_addMessages'],
- [$this->validators]
- );
+ $this->validator = $this->getMockBuilder(
+ \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator::class
+ )
+ ->setMethods(['_clearMessages', '_addMessages'])
+ ->setConstructorArgs([$this->validators])
+ ->getMock();
}
/**
diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php
index bb4e8c0af12c6..6d130d93ee6a5 100644
--- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php
+++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php
@@ -6,9 +6,9 @@
namespace Magento\AdvancedPricingImportExport\Test\Unit\Model\Import;
-use \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing as AdvancedPricing;
-use \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory as ResourceFactory;
-use \Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as RowValidatorInterface;
+use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing as AdvancedPricing;
+use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as RowValidatorInterface;
+use Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory as ResourceFactory;
/**
* @SuppressWarnings(PHPMD)
@@ -127,34 +127,10 @@ protected function setUp()
{
parent::setUp();
- $this->jsonHelper = $this->getMock(
- \Magento\Framework\Json\Helper\Data::class,
- [],
- [],
- '',
- false
- );
- $this->importExportData = $this->getMock(
- \Magento\ImportExport\Helper\Data::class,
- [],
- [],
- '',
- false
- );
- $this->resourceHelper = $this->getMock(
- \Magento\ImportExport\Model\ResourceModel\Helper::class,
- [],
- [],
- '',
- false
- );
- $this->resource = $this->getMock(
- \Magento\Framework\App\ResourceConnection::class,
- ['getConnection'],
- [],
- '',
- false
- );
+ $this->jsonHelper = $this->createMock(\Magento\Framework\Json\Helper\Data::class);
+ $this->importExportData = $this->createMock(\Magento\ImportExport\Helper\Data::class);
+ $this->resourceHelper = $this->createMock(\Magento\ImportExport\Model\ResourceModel\Helper::class);
+ $this->resource = $this->createPartialMock(\Magento\Framework\App\ResourceConnection::class, ['getConnection']);
$this->connection = $this->getMockForAbstractClass(
\Magento\Framework\DB\Adapter\AdapterInterface::class,
[],
@@ -162,101 +138,40 @@ protected function setUp()
false
);
$this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
- $this->dataSourceModel = $this->getMock(
- \Magento\ImportExport\Model\ResourceModel\Import\Data::class,
- [],
- [],
- '',
- false
- );
- $this->eavConfig = $this->getMock(
- \Magento\Eav\Model\Config::class,
- [],
- [],
- '',
- false
- );
- $entityType = $this->getMock(
- \Magento\Eav\Model\Entity\Type::class,
- [],
- [],
- '',
- false
- );
+ $this->dataSourceModel = $this->createMock(\Magento\ImportExport\Model\ResourceModel\Import\Data::class);
+ $this->eavConfig = $this->createMock(\Magento\Eav\Model\Config::class);
+ $entityType = $this->createMock(\Magento\Eav\Model\Entity\Type::class);
$entityType->method('getEntityTypeId')->willReturn('');
$this->eavConfig->method('getEntityType')->willReturn($entityType);
- $this->resourceFactory = $this->getMock(
- \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory::class,
- ['create', 'getTable'],
- [],
- '',
- false
- );
+ $this->resourceFactory = $this->getMockBuilder(
+ \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModelFactory::class
+ )
+ ->setMethods(['create', 'getTable'])
+ ->disableOriginalConstructor()
+ ->getMock();
$this->resourceFactory->expects($this->any())->method('create')->willReturnSelf();
$this->resourceFactory->expects($this->any())->method('getTable')->willReturn(self::TABLE_NAME);
- $this->catalogData = $this->getMock(
- \Magento\Catalog\Helper\Data::class,
- [],
- [],
- '',
- false
- );
- $this->storeResolver = $this->getMock(
- \Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class,
- [],
- [],
- '',
- false
- );
- $this->importProduct = $this->getMock(
- \Magento\CatalogImportExport\Model\Import\Product::class,
- [],
- [],
- '',
- false
+ $this->catalogData = $this->createMock(\Magento\Catalog\Helper\Data::class);
+ $this->storeResolver = $this->createMock(
+ \Magento\CatalogImportExport\Model\Import\Product\StoreResolver::class
);
- $this->productModel = $this->getMock(
- \Magento\Catalog\Model\Product::class,
- [],
- [],
- '',
- false
- );
- $this->validator = $this->getMock(
+ $this->importProduct = $this->createMock(\Magento\CatalogImportExport\Model\Import\Product::class);
+ $this->productModel = $this->createMock(\Magento\Catalog\Model\Product::class);
+ $this->validator = $this->createPartialMock(
\Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator::class,
- ['isValid', 'getMessages'],
- [],
- '',
- false
+ ['isValid', 'getMessages']
);
- $this->websiteValidator = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\Website::class,
- [],
- [],
- '',
- false
- );
- $this->tierPriceValidator = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TierPrice::class,
- [],
- [],
- '',
- false
+ $this->websiteValidator = $this->createMock(
+ \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\Website::class
);
- $this->stringObject = $this->getMock(
- \Magento\Framework\Stdlib\StringUtils::class,
- [],
- [],
- '',
- false
+ $this->tierPriceValidator = $this->createMock(
+ \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TierPrice::class
);
+ $this->stringObject = $this->createMock(\Magento\Framework\Stdlib\StringUtils::class);
$this->errorAggregator = $this->getErrorAggregatorObject();
- $this->dateTime = $this->getMock(
+ $this->dateTime = $this->createPartialMock(
\Magento\Framework\Stdlib\DateTime\DateTime::class,
- ['date', 'format'],
- [],
- '',
- false
+ ['date', 'format']
);
$this->dateTime->expects($this->any())->method('date')->willReturnSelf();
@@ -890,7 +805,7 @@ public function testDeleteProductTierPrices(
$result
) {
$this->advancedPricing = $this->getAdvancedPricingMock(['addRowError', 'retrieveOldSkus']);
- $dbSelectMock = $this->getMock(\Magento\Framework\DB\Select::class, [], [], '', false);
+ $dbSelectMock = $this->createMock(\Magento\Framework\DB\Select::class);
if ($listSku) {
$this->connection->expects($this->once())
->method('fetchCol')
@@ -983,7 +898,7 @@ public function testProcessCountExistingPrices(
'retrieveOldSkus'
]
);
- $dbSelectMock = $this->getMock(\Magento\Framework\DB\Select::class, [], [], '', false);
+ $dbSelectMock = $this->createMock(\Magento\Framework\DB\Select::class);
$this->connection->expects($this->once())
->method('fetchAssoc')
->willReturn($existingPrices);
@@ -1086,20 +1001,8 @@ private function invokeMethod($object, $method, $args = [])
*/
private function getAdvancedPricingMock($methods = [])
{
- $metadataPoolMock = $this->getMock(
- \Magento\Framework\EntityManager\MetadataPool::class,
- [],
- [],
- '',
- false
- );
- $metadataMock = $this->getMock(
- \Magento\Framework\EntityManager\EntityMetadata::class,
- [],
- [],
- '',
- false
- );
+ $metadataPoolMock = $this->createMock(\Magento\Framework\EntityManager\MetadataPool::class);
+ $metadataMock = $this->createMock(\Magento\Framework\EntityManager\EntityMetadata::class);
$metadataMock->expects($this->any())
->method('getLinkField')
->willReturn(self::LINK_FIELD);
@@ -1107,30 +1010,32 @@ private function getAdvancedPricingMock($methods = [])
->method('getMetaData')
->with(\Magento\Catalog\Api\Data\ProductInterface::class)
->willReturn($metadataMock);
- $advancedPricingMock = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing::class,
- $methods,
- [
- $this->jsonHelper,
- $this->importExportData,
- $this->dataSourceModel,
- $this->eavConfig,
- $this->resource,
- $this->resourceHelper,
- $this->stringObject,
- $this->errorAggregator,
- $this->dateTime,
- $this->resourceFactory,
- $this->productModel,
- $this->catalogData,
- $this->storeResolver,
- $this->importProduct,
- $this->validator,
- $this->websiteValidator,
- $this->tierPriceValidator
- ],
- ''
- );
+ $advancedPricingMock = $this->getMockBuilder(
+ \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing::class
+ )
+ ->setMethods($methods)
+ ->setConstructorArgs(
+ [
+ $this->jsonHelper,
+ $this->importExportData,
+ $this->dataSourceModel,
+ $this->eavConfig,
+ $this->resource,
+ $this->resourceHelper,
+ $this->stringObject,
+ $this->errorAggregator,
+ $this->dateTime,
+ $this->resourceFactory,
+ $this->productModel,
+ $this->catalogData,
+ $this->storeResolver,
+ $this->importProduct,
+ $this->validator,
+ $this->websiteValidator,
+ $this->tierPriceValidator
+ ]
+ )
+ ->getMock();
$reflection = new \ReflectionClass(\Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing::class);
$reflectionProperty = $reflection->getProperty('metadataPool');
$reflectionProperty->setAccessible(true);
diff --git a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Indexer/Product/Price/Plugin/ImportTest.php b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Indexer/Product/Price/Plugin/ImportTest.php
index 49b03762a725f..794b497d9a037 100644
--- a/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Indexer/Product/Price/Plugin/ImportTest.php
+++ b/app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Indexer/Product/Price/Plugin/ImportTest.php
@@ -6,9 +6,9 @@
namespace Magento\AdvancedPricingImportExport\Test\Unit\Model\Indexer\Product\Price\Plugin;
-use \Magento\AdvancedPricingImportExport\Model\Indexer\Product\Price\Plugin\Import as Import;
+use Magento\AdvancedPricingImportExport\Model\Indexer\Product\Price\Plugin\Import as Import;
-class ImportTest extends \PHPUnit_Framework_TestCase
+class ImportTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Framework\Indexer\IndexerInterface |\PHPUnit_Framework_MockObject_MockObject
@@ -33,19 +33,12 @@ protected function setUp()
'',
false
);
- $this->import = $this->getMock(
+ $this->import = $this->createPartialMock(
\Magento\AdvancedPricingImportExport\Model\Indexer\Product\Price\Plugin\Import::class,
- ['getPriceIndexer', 'invalidateIndexer'],
- [],
- '',
- false
+ ['getPriceIndexer', 'invalidateIndexer']
);
- $this->advancedPricing = $this->getMock(
- \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing::class,
- [],
- [],
- '',
- false
+ $this->advancedPricing = $this->createMock(
+ \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing::class
);
$this->import->expects($this->any())->method('getPriceIndexer')->willReturn($this->indexer);
}
diff --git a/app/code/Magento/AdvancedPricingImportExport/composer.json b/app/code/Magento/AdvancedPricingImportExport/composer.json
index 228464ecd6304..acc3e3ead715a 100644
--- a/app/code/Magento/AdvancedPricingImportExport/composer.json
+++ b/app/code/Magento/AdvancedPricingImportExport/composer.json
@@ -3,17 +3,17 @@
"description": "N/A",
"require": {
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
- "magento/module-catalog": "101.1.*",
- "magento/module-catalog-inventory": "100.2.*",
- "magento/module-eav": "100.2.*",
- "magento/module-import-export": "100.2.*",
- "magento/module-catalog-import-export": "100.2.*",
- "magento/module-customer": "100.2.*",
- "magento/module-store": "100.2.*",
- "magento/framework": "100.2.*"
+ "magento/module-catalog": "101.2.*",
+ "magento/module-catalog-inventory": "100.3.*",
+ "magento/module-eav": "100.3.*",
+ "magento/module-import-export": "100.3.*",
+ "magento/module-catalog-import-export": "100.3.*",
+ "magento/module-customer": "100.3.*",
+ "magento/module-store": "100.3.*",
+ "magento/framework": "100.3.*"
},
"type": "magento2-module",
- "version": "100.2.0-dev",
+ "version": "100.3.0-dev",
"license": [
"OSL-3.0",
"AFL-3.0"
diff --git a/app/code/Magento/AdvancedPricingImportExport/i18n/en_US.csv b/app/code/Magento/AdvancedPricingImportExport/i18n/en_US.csv
index 56b3d249c4123..54afa107ef377 100644
--- a/app/code/Magento/AdvancedPricingImportExport/i18n/en_US.csv
+++ b/app/code/Magento/AdvancedPricingImportExport/i18n/en_US.csv
@@ -1,4 +1,4 @@
"Please correct the data sent.","Please correct the data sent."
-"Entity type model \'%1\' is not found","Entity type model \'%1\' is not found"
+"Entity type model '%1' is not found","Entity type model '%1' is not found"
"Entity type model must be an instance of \Magento\CatalogImportExport\Model\Export\Product\Type\AbstractType","Entity type model must be an instance of \Magento\CatalogImportExport\Model\Export\Product\Type\AbstractType"
"There are no product types available for export","There are no product types available for export"
diff --git a/app/code/Magento/AdvancedPricingImportExport/registration.php b/app/code/Magento/AdvancedPricingImportExport/registration.php
index bd00e7cf7d5ae..7a1d2feeccd45 100644
--- a/app/code/Magento/AdvancedPricingImportExport/registration.php
+++ b/app/code/Magento/AdvancedPricingImportExport/registration.php
@@ -4,8 +4,6 @@
* See COPYING.txt for license details.
*/
-\Magento\Framework\Component\ComponentRegistrar::register(
- \Magento\Framework\Component\ComponentRegistrar::MODULE,
- 'Magento_AdvancedPricingImportExport',
- __DIR__
-);
+use \Magento\Framework\Component\ComponentRegistrar;
+
+ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AdvancedPricingImportExport', __DIR__);
diff --git a/app/code/Magento/Analytics/Api/Data/LinkInterface.php b/app/code/Magento/Analytics/Api/Data/LinkInterface.php
deleted file mode 100644
index 6597dff868b9f..0000000000000
--- a/app/code/Magento/Analytics/Api/Data/LinkInterface.php
+++ /dev/null
@@ -1,24 +0,0 @@
-' . $element->getLabel() . '
';
- $html .= '';
- return $this->decorateRowHtml($element, $html);
- }
-
- /**
- * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
- * @param string $html
- * @return string
- */
- private function decorateRowHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element, $html)
- {
- return sprintf(
- '
',
- $element->getHtmlId(),
- $html
- );
- }
-}
diff --git a/app/code/Magento/Analytics/Block/Adminhtml/System/Config/CollectionTimeLabel.php b/app/code/Magento/Analytics/Block/Adminhtml/System/Config/CollectionTimeLabel.php
deleted file mode 100644
index c4118792255cd..0000000000000
--- a/app/code/Magento/Analytics/Block/Adminhtml/System/Config/CollectionTimeLabel.php
+++ /dev/null
@@ -1,29 +0,0 @@
-_localeDate->getConfigTimezone();
- $getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)->getDisplayName();
- $element->setData(
- 'comment',
- sprintf("%s (%s)", $getLongTimeZoneName, $timeZoneCode)
- );
- return parent::render($element);
- }
-}
diff --git a/app/code/Magento/Analytics/Block/Adminhtml/System/Config/SubscriptionStatusLabel.php b/app/code/Magento/Analytics/Block/Adminhtml/System/Config/SubscriptionStatusLabel.php
deleted file mode 100644
index c09213c7f009d..0000000000000
--- a/app/code/Magento/Analytics/Block/Adminhtml/System/Config/SubscriptionStatusLabel.php
+++ /dev/null
@@ -1,64 +0,0 @@
-subscriptionStatusProvider = $labelStatusProvider;
- }
-
- /**
- * Add Subscription status to comment
- *
- * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
- * @return string
- */
- public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
- {
- $element->setData(
- 'comment',
- $this->prepareLabelValue()
- );
- return parent::render($element);
- }
-
- /**
- * Prepare label for subscription status
- *
- * @return string
- */
- private function prepareLabelValue()
- {
- return __('Subscription status') . ': ' . __($this->subscriptionStatusProvider->getStatus());
- }
-}
diff --git a/app/code/Magento/Analytics/Controller/Adminhtml/BIEssentials/SignUp.php b/app/code/Magento/Analytics/Controller/Adminhtml/BIEssentials/SignUp.php
deleted file mode 100644
index a90a971cf41b4..0000000000000
--- a/app/code/Magento/Analytics/Controller/Adminhtml/BIEssentials/SignUp.php
+++ /dev/null
@@ -1,64 +0,0 @@
-config = $config;
- parent::__construct($context);
- }
-
- /**
- * Check admin permissions for this controller
- *
- * @return boolean
- */
- protected function _isAllowed()
- {
- return $this->_authorization->isAllowed('Magento_Analytics::bi_essentials');
- }
-
- /**
- * Provides link to BI Essentials signup
- *
- * @return \Magento\Framework\Controller\AbstractResult
- */
- public function execute()
- {
- return $this->resultRedirectFactory->create()->setUrl(
- $this->config->getValue($this->urlBIEssentialsConfigPath)
- );
- }
-}
diff --git a/app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php b/app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php
deleted file mode 100644
index 7f0aade798e18..0000000000000
--- a/app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php
+++ /dev/null
@@ -1,71 +0,0 @@
-reportUrlProvider = $reportUrlProvider;
- parent::__construct($context);
- }
-
- /**
- * Check admin permissions for this controller.
- *
- * @return boolean
- */
- protected function _isAllowed()
- {
- return $this->_authorization->isAllowed('Magento_Analytics::analytics_settings');
- }
-
- /**
- * Redirect to resource with reports.
- *
- * @return Redirect $resultRedirect
- */
- public function execute()
- {
- /** @var Redirect $resultRedirect */
- $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
- try {
- $resultRedirect->setUrl($this->reportUrlProvider->getUrl());
- } catch (LocalizedException $e) {
- $this->getMessageManager()->addExceptionMessage($e, $e->getMessage());
- $resultRedirect->setPath('adminhtml');
- } catch (\Exception $e) {
- $this->getMessageManager()->addExceptionMessage(
- $e,
- __('Sorry, there has been an error processing your request. Please try again later.')
- );
- $resultRedirect->setPath('adminhtml');
- }
-
- return $resultRedirect;
- }
-}
diff --git a/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Activate.php b/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Activate.php
deleted file mode 100644
index b5731fc07bb07..0000000000000
--- a/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Activate.php
+++ /dev/null
@@ -1,133 +0,0 @@
-logger = $logger;
- $this->notificationTime = $notificationTime;
- $this->configValueResource = $configValueResource;
- $this->preparedValueFactory = $preparedValueFactory;
- parent::__construct($context);
- }
-
- /**
- * Check admin permissions for this controller
- *
- * @return boolean
- */
- protected function _isAllowed()
- {
- return $this->_authorization->isAllowed('Magento_Analytics::analytics_settings');
- }
-
- /**
- * Activate subscription to Magento BI via AJAX.
- *
- * @return Json
- */
- public function execute()
- {
- try {
- if ($this->getRequest()->getParam($this->subscriptionApprovedField)) {
- $configValue = $this->preparedValueFactory->create(
- Enabled::XML_ENABLED_CONFIG_STRUCTURE_PATH,
- Enabledisable::ENABLE_VALUE,
- ScopeConfigInterface::SCOPE_TYPE_DEFAULT
- );
-
- $this->configValueResource
- ->save($configValue);
- } else {
- $this->notificationTime->unsetLastTimeNotificationValue();
- }
- $responseContent = [
- 'success' => true,
- 'error_message' => '',
- ];
- } catch (LocalizedException $e) {
- $responseContent = [
- 'success' => false,
- 'error_message' => $e->getMessage(),
- ];
- $this->logger->error($e->getMessage());
- } catch (\Exception $e) {
- $responseContent = [
- 'success' => false,
- 'error_message' => __(
- 'Sorry, there was an error processing your registration request to Magento Analytics. '
- . 'Please try again later.'
- ),
- ];
- $this->logger->error($e->getMessage());
- }
- /** @var Json $resultJson */
- $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
- return $resultJson->setData($responseContent);
- }
-}
diff --git a/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Postpone.php b/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Postpone.php
deleted file mode 100644
index 29918be63d898..0000000000000
--- a/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Postpone.php
+++ /dev/null
@@ -1,96 +0,0 @@
-dateTimeFactory = $dateTimeFactory;
- $this->notificationTime = $notificationTime;
- $this->logger = $logger;
- parent::__construct($context);
- }
-
- /**
- * Check admin permissions for this controller
- *
- * @return boolean
- */
- protected function _isAllowed()
- {
- return $this->_authorization->isAllowed('Magento_Analytics::analytics_settings');
- }
-
- /**
- * Postpones notification about subscription
- *
- * @return Json
- */
- public function execute()
- {
- try {
- $dateTime = $this->dateTimeFactory->create();
- $responseContent = [
- 'success' => $this->notificationTime->storeLastTimeNotification($dateTime->getTimestamp()),
- 'error_message' => ''
- ];
- } catch (LocalizedException $e) {
- $this->logger->error($e->getMessage());
- $responseContent = [
- 'success' => false,
- 'error_message' => $e->getMessage()
- ];
- } catch (\Exception $e) {
- $this->logger->error($e->getMessage());
- $responseContent = [
- 'success' => false,
- 'error_message' => __('Error occurred during postponement notification')
- ];
- }
- /** @var Json $resultJson */
- $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
- return $resultJson->setData($responseContent);
- }
-}
diff --git a/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Retry.php b/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Retry.php
deleted file mode 100644
index 122cf74123cc9..0000000000000
--- a/app/code/Magento/Analytics/Controller/Adminhtml/Subscription/Retry.php
+++ /dev/null
@@ -1,73 +0,0 @@
-subscriptionHandler = $subscriptionHandler;
- parent::__construct($context);
- }
-
- /**
- * Check admin permissions for this controller
- *
- * @return boolean
- */
- protected function _isAllowed()
- {
- return $this->_authorization->isAllowed('Magento_Analytics::analytics_settings');
- }
-
- /**
- * Retry process of subscription.
- *
- * @return Redirect
- */
- public function execute()
- {
- /** @var Redirect $resultRedirect */
- $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
- try {
- $resultRedirect->setPath('adminhtml');
- $this->subscriptionHandler->processEnabled();
- } catch (LocalizedException $e) {
- $this->getMessageManager()->addExceptionMessage($e, $e->getMessage());
- } catch (\Exception $e) {
- $this->getMessageManager()->addExceptionMessage(
- $e,
- __('Sorry, there has been an error processing your request. Please try again later.')
- );
- }
-
- return $resultRedirect;
- }
-}
diff --git a/app/code/Magento/Analytics/Cron/CollectData.php b/app/code/Magento/Analytics/Cron/CollectData.php
deleted file mode 100644
index ff0b3e4f67638..0000000000000
--- a/app/code/Magento/Analytics/Cron/CollectData.php
+++ /dev/null
@@ -1,53 +0,0 @@
-exportDataHandler = $exportDataHandler;
- $this->subscriptionStatus = $subscriptionStatus;
- }
-
- /**
- * @return bool
- */
- public function execute()
- {
- if ($this->subscriptionStatus->getStatus() === SubscriptionStatusProvider::ENABLED) {
- $this->exportDataHandler->prepareExportData();
- }
-
- return true;
- }
-}
diff --git a/app/code/Magento/Analytics/Cron/SignUp.php b/app/code/Magento/Analytics/Cron/SignUp.php
deleted file mode 100644
index c17b9b8c381c3..0000000000000
--- a/app/code/Magento/Analytics/Cron/SignUp.php
+++ /dev/null
@@ -1,101 +0,0 @@
-connector = $connector;
- $this->configWriter = $configWriter;
- $this->flagManager = $flagManager;
- $this->reinitableConfig = $reinitableConfig;
- }
-
- /**
- * Execute scheduled subscription operation
- * In case of failure writes message to notifications inbox
- *
- * @return bool
- */
- public function execute()
- {
- $attemptsCount = $this->flagManager->getFlagData(SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE);
-
- if (($attemptsCount === null) || ($attemptsCount <= 0)) {
- $this->deleteAnalyticsCronExpr();
- $this->flagManager->deleteFlag(SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE);
- return false;
- }
-
- $attemptsCount -= 1;
- $this->flagManager->saveFlag(SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE, $attemptsCount);
- $signUpResult = $this->connector->execute('signUp');
- if ($signUpResult === false) {
- return false;
- }
-
- $this->deleteAnalyticsCronExpr();
- $this->flagManager->deleteFlag(SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE);
- return true;
- }
-
- /**
- * Delete cron schedule setting into config.
- *
- * Delete cron schedule setting for subscription handler into config and
- * re-initialize config cache to avoid auto-generate new schedule items.
- *
- * @return bool
- */
- private function deleteAnalyticsCronExpr()
- {
- $this->configWriter->delete(SubscriptionHandler::CRON_STRING_PATH);
- $this->reinitableConfig->reinit();
- return true;
- }
-}
diff --git a/app/code/Magento/Analytics/Cron/Update.php b/app/code/Magento/Analytics/Cron/Update.php
deleted file mode 100644
index 36e6c3e59e5c7..0000000000000
--- a/app/code/Magento/Analytics/Cron/Update.php
+++ /dev/null
@@ -1,77 +0,0 @@
-connector = $connector;
- $this->configWriter = $configWriter;
- $this->reinitableConfig = $reinitableConfig;
- $this->flagManager = $flagManager;
- }
-
- /**
- * Execute scheduled update operation
- *
- * @return bool
- */
- public function execute()
- {
- $updateResult = $this->connector->execute('update');
- if ($updateResult === false) {
- return false;
- }
- $this->configWriter->delete(BaseUrlConfigPlugin::UPDATE_CRON_STRING_PATH);
- $this->flagManager->deleteFlag(BaseUrlConfigPlugin::OLD_BASE_URL_FLAG_CODE);
- $this->reinitableConfig->reinit();
- return true;
- }
-}
diff --git a/app/code/Magento/Analytics/Model/AnalyticsToken.php b/app/code/Magento/Analytics/Model/AnalyticsToken.php
deleted file mode 100644
index ccec4d1bbe958..0000000000000
--- a/app/code/Magento/Analytics/Model/AnalyticsToken.php
+++ /dev/null
@@ -1,92 +0,0 @@
-reinitableConfig = $reinitableConfig;
- $this->config = $config;
- $this->configWriter = $configWriter;
- }
-
- /**
- * Get Magento BI token value.
- *
- * @return string|null
- */
- public function getToken()
- {
- return $this->config->getValue($this->tokenPath);
- }
-
- /**
- * Stores Magento BI token value.
- *
- * @param string $value
- *
- * @return bool
- */
- public function storeToken($value)
- {
- $this->configWriter->save($this->tokenPath, $value);
- $this->reinitableConfig->reinit();
-
- return true;
- }
-
- /**
- * Check Magento BI token value exist.
- *
- * @return bool
- */
- public function isTokenExist()
- {
- return (bool)$this->getToken();
- }
-}
diff --git a/app/code/Magento/Analytics/Model/Condition/CanViewNotification.php b/app/code/Magento/Analytics/Model/Condition/CanViewNotification.php
deleted file mode 100644
index bffe746fe7383..0000000000000
--- a/app/code/Magento/Analytics/Model/Condition/CanViewNotification.php
+++ /dev/null
@@ -1,80 +0,0 @@
-notificationTime = $notificationTime;
- $this->dateTimeFactory = $dateTimeFactory;
- }
-
- /**
- * Validate is notification popup can be shown
- *
- * @inheritdoc
- */
- public function isVisible(array $arguments)
- {
- $lastNotificationTime = $this->notificationTime->getLastTimeNotification();
- if (!$lastNotificationTime) {
- return false;
- }
- $datetime = $this->dateTimeFactory->create();
- return (
- $datetime->getTimestamp() >= $lastNotificationTime + $this->notificationInterval
- );
- }
-
- /**
- * @return string
- */
- public function getName()
- {
- return self::NAME;
- }
-}
diff --git a/app/code/Magento/Analytics/Model/Config.php b/app/code/Magento/Analytics/Model/Config.php
deleted file mode 100644
index ba508187b4b9f..0000000000000
--- a/app/code/Magento/Analytics/Model/Config.php
+++ /dev/null
@@ -1,40 +0,0 @@
-data = $data;
- }
-
- /**
- * Get config value by key.
- *
- * @param string|null $key
- * @param string|null $default
- * @return array
- */
- public function get($key = null, $default = null)
- {
- return $this->data->get($key, $default);
- }
-}
diff --git a/app/code/Magento/Analytics/Model/Config/Backend/CollectionTime.php b/app/code/Magento/Analytics/Model/Config/Backend/CollectionTime.php
deleted file mode 100644
index e26ad01fc74bf..0000000000000
--- a/app/code/Magento/Analytics/Model/Config/Backend/CollectionTime.php
+++ /dev/null
@@ -1,91 +0,0 @@
-configWriter = $configWriter;
- parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data);
- }
-
- /**
- * {@inheritdoc}
- *
- * {@inheritdoc}. Set schedule setting for cron.
- *
- * @return Value
- */
- public function afterSave()
- {
- $result = preg_match('#(?