Skip to content

Commit

Permalink
Remove deprecated interfaces part 1 magento#32061
Browse files Browse the repository at this point in the history
  • Loading branch information
adamphh committed Feb 18, 2021
1 parent 4766b88 commit a2352c1
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 67 deletions.
6 changes: 3 additions & 3 deletions app/code/Magento/AdvancedSearch/Block/SearchData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Magento\AdvancedSearch\Block;

use Magento\Framework\View\Element\Template;
use Magento\Search\Model\QueryFactory as QueryFactoryInterface;
use Magento\Search\Model\QueryFactory;
use Magento\Search\Model\QueryInterface;
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;

Expand Down Expand Up @@ -35,14 +35,14 @@ abstract class SearchData extends Template implements SearchDataInterface
/**
* @param Template\Context $context
* @param SuggestedQueriesInterface $searchDataProvider
* @param QueryFactoryInterface $queryFactory
* @param QueryFactory $queryFactory
* @param string $title
* @param array $data
*/
public function __construct(
Template\Context $context,
SuggestedQueriesInterface $searchDataProvider,
QueryFactoryInterface $queryFactory,
QueryFactory $queryFactory,
$title,
array $data = []
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\AdvancedSearch\Block\SearchData;
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
use Magento\Framework\View\Element\Template\Context as TemplateContext;
use Magento\Search\Model\QueryFactory as QueryFactoryInterface;
use Magento\Search\Model\QueryFactory;
use Magento\Search\Model\QueryInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -33,7 +33,7 @@ class SearchDataTest extends TestCase
private $contextMock;

/**
* @var QueryFactoryInterface|MockObject
* @var QueryFactory|MockObject
*/
private $queryFactoryMock;

Expand All @@ -58,7 +58,7 @@ protected function setUp(): void
->disableOriginalConstructor()
->setMethods(['getQueryText'])
->getMockForAbstractClass();
$this->queryFactoryMock = $this->getMockBuilder(QueryFactoryInterface::class)
$this->queryFactoryMock = $this->getMockBuilder(QueryFactory::class)
->disableOriginalConstructor()
->setMethods(['get'])
->getMockForAbstractClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Magento\Directory\Model\ResourceModel\Country\Collection;
use Magento\Directory\Model\ResourceModel\Country\CollectionFactory;
use Magento\Store\Api\Data\StoreInterface;
use Magento\Store\Model\StoreResolver as StoreResolverInterface;
use Magento\Store\Model\StoreResolver;
use Magento\Store\Model\StoreManagerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -76,7 +76,7 @@ protected function setUp(): void
\Magento\Directory\Model\ResourceModel\Region\Collection::class
);
$this->storeResolverMock = $this->createMock(
StoreResolverInterface::class
StoreResolver::class
);
$this->directoryDataHelperMock = $this->createMock(Data::class);
$this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\MediaContentApi\Model\SearchPatternConfigInterface;
use Magento\MediaContentApi\Api\ExtractAssetsFromContentInterface;
use Magento\MediaGalleryApi\Api\Data\AssetInterface;
use Magento\MediaGalleryApi\Api\GetAssetsByPathsInterface as GetByPathInterface;
use Magento\MediaGalleryApi\Api\GetAssetsByPathsInterface;
use Psr\Log\LoggerInterface;

/**
Expand All @@ -24,7 +24,7 @@ class ExtractAssetsFromContent implements ExtractAssetsFromContentInterface
private $searchPatternConfig;

/**
* @var GetByPathInterface
* @var GetAssetsByPathsInterface
*/
private $getMediaAssetByPath;

Expand All @@ -35,12 +35,12 @@ class ExtractAssetsFromContent implements ExtractAssetsFromContentInterface

/**
* @param SearchPatternConfigInterface $searchPatternConfig
* @param GetByPathInterface $getMediaAssetByPath
* @param GetAssetsByPathsInterface $getMediaAssetByPath
* @param LoggerInterface $logger
*/
public function __construct(
SearchPatternConfigInterface $searchPatternConfig,
GetByPathInterface $getMediaAssetByPath,
GetAssetsByPathsInterface $getMediaAssetByPath,
LoggerInterface $logger
) {
$this->searchPatternConfig = $searchPatternConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\Exception\CouldNotDeleteException;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\MediaGallery\Model\ResourceModel\DeleteAssetsByPaths as DeleteByPath;
use Magento\MediaGallery\Model\ResourceModel\DeleteAssetsByPaths;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
Expand All @@ -25,7 +25,7 @@ class DeleteByPathTest extends TestCase
private const FILE_PATH = 'test-file-path/test.jpg';

/**
* @var DeleteByPath
* @var DeleteAssetsByPaths
*/
private $deleteMediaAssetByPath;

Expand All @@ -48,7 +48,7 @@ protected function setUp(): void
$resourceConnection = $this->createMock(ResourceConnection::class);

$this->deleteMediaAssetByPath = (new ObjectManager($this))->getObject(
DeleteByPath::class,
DeleteAssetsByPaths::class,
[
'resourceConnection' => $resourceConnection,
'logger' => $this->logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
use Magento\Framework\DB\Select;
use Magento\Framework\Exception\IntegrationException;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\MediaGallery\Model\ResourceModel\GetAssetsByIds as GetById;
use Magento\MediaGallery\Model\ResourceModel\GetAssetsByIds;
use Magento\MediaGalleryApi\Api\Data\AssetInterfaceFactory;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;

/**
* Test the GetById command with exception during media asset initialization
* Test the GetAssetsByIds command with exception during media asset initialization
*/
class GetByIdExceptionDuringMediaAssetInitializationTest extends TestCase
{
Expand All @@ -40,7 +40,7 @@ class GetByIdExceptionDuringMediaAssetInitializationTest extends TestCase
];

/**
* @var GetById|MockObject
* @var GetAssetsByIds|MockObject
*/
private $getMediaAssetById;

Expand Down Expand Up @@ -74,7 +74,7 @@ protected function setUp(): void
$this->logger = $this->getMockForAbstractClass(LoggerInterface::class);

$this->getMediaAssetById = (new ObjectManager($this))->getObject(
GetById::class,
GetAssetsByIds::class,
[
'resourceConnection' => $resourceConnection,
'assetFactory' => $this->assetFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
use Magento\Framework\DB\Select;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\MediaGallery\Model\ResourceModel\GetAssetsByIds as GetById;
use Magento\MediaGallery\Model\ResourceModel\GetAssetsByIds;
use Magento\MediaGalleryApi\Api\Data\AssetInterfaceFactory;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;

/**
* Test the GetById command with exception thrown in case when there is no such entity
* Test the GetAssetsByIds command with exception thrown in case when there is no such entity
*/
class GetByIdExceptionNoSuchEntityTest extends TestCase
{
private const MEDIA_ASSET_STUB_ID = 1;

/**
* @var GetById|MockObject
* @var GetAssetsByIds|MockObject
*/
private $getMediaAssetById;

Expand Down Expand Up @@ -61,7 +61,7 @@ protected function setUp(): void
$logger = $this->getMockForAbstractClass(LoggerInterface::class);

$this->getMediaAssetById = (new ObjectManager($this))->getObject(
GetById::class,
GetAssetsByIds::class,
[
'resourceConnection' => $resourceConnection,
'assetFactory' => $this->assetFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
use Magento\Framework\DB\Select;
use Magento\Framework\Exception\IntegrationException;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\MediaGallery\Model\ResourceModel\GetAssetsByIds as GetById;
use Magento\MediaGallery\Model\ResourceModel\GetAssetsByIds;
use Magento\MediaGalleryApi\Api\Data\AssetInterfaceFactory;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;

/**
* Test the GetById command with exception during get media data
* Test the GetAssetsByIds command with exception during get media data
*/
class GetByIdExceptionOnGetDataTest extends TestCase
{
Expand All @@ -41,7 +41,7 @@ class GetByIdExceptionOnGetDataTest extends TestCase
];

/**
* @var GetById|MockObject
* @var GetAssetsByIds|MockObject
*/
private $getMediaAssetById;
/**
Expand Down Expand Up @@ -74,7 +74,7 @@ protected function setUp(): void
$this->logger = $this->getMockForAbstractClass(LoggerInterface::class);

$this->getMediaAssetById = (new ObjectManager($this))->getObject(
GetById::class,
GetAssetsByIds::class,
[
'resourceConnection' => $resourceConnection,
'assetFactory' => $assetFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Select;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\MediaGallery\Model\ResourceModel\GetAssetsByIds as GetById;
use Magento\MediaGallery\Model\ResourceModel\GetAssetsByIds;
use Magento\MediaGalleryApi\Api\Data\AssetInterface;
use Magento\MediaGalleryApi\Api\Data\AssetInterfaceFactory;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;

/**
* Test the GetById command successful scenario
* Test the GetAssetsByIds command successful scenario
*/
class GetByIdSuccessfulTest extends TestCase
{
Expand All @@ -41,7 +41,7 @@ class GetByIdSuccessfulTest extends TestCase
];

/**
* @var GetById|MockObject
* @var GetAssetsByIds|MockObject
*/
private $getMediaAssetById;

Expand Down Expand Up @@ -75,7 +75,7 @@ protected function setUp(): void
$logger = $this->getMockForAbstractClass(LoggerInterface::class);

$this->getMediaAssetById = (new ObjectManager($this))->getObject(
GetById::class,
GetAssetsByIds::class,
[
'resourceConnection' => $resourceConnection,
'assetFactory' => $this->assetFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Reflection\DataObjectProcessor;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\MediaGallery\Model\ResourceModel\SaveAssets as Save;
use Magento\MediaGallery\Model\ResourceModel\SaveAssets;
use Magento\MediaGalleryApi\Api\Data\AssetInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -84,7 +84,7 @@ class SaveTest extends TestCase
private $mediaAssetMock;

/**
* @var Save
* @var SaveAssets
*/
private $save;

Expand All @@ -110,7 +110,7 @@ protected function setUp(): void

/* Create Save instance with mocks */
$this->save = (new ObjectManager($this))->getObject(
Save::class,
SaveAssets::class,
[
'resourceConnection' => $this->resourceConnectionMock,
'objectProcessor' => $this->objectProcessor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\DB\Select;
use Magento\Framework\Exception\IntegrationException;
use Magento\MediaGallery\Model\ResourceModel\Keyword\GetAssetsKeywords as GetAssetKeywords;
use Magento\MediaGallery\Model\ResourceModel\Keyword\GetAssetsKeywords;
use Magento\MediaGalleryApi\Api\Data\KeywordInterface;
use Magento\MediaGalleryApi\Api\Data\KeywordInterfaceFactory;
use PHPUnit\Framework\MockObject\MockObject;
Expand All @@ -21,7 +21,7 @@
class GetAssetKeywordsTest extends TestCase
{
/**
* @var GetAssetKeywords
* @var GetAssetsKeywords
*/
private $sut;

Expand All @@ -46,7 +46,7 @@ protected function setUp(): void
$this->assetKeywordFactoryStub = $this->createMock(KeywordInterfaceFactory::class);
$this->loggerMock = $this->getMockForAbstractClass(LoggerInterface::class);

$this->sut = new GetAssetKeywords(
$this->sut = new GetAssetsKeywords(
$this->resourceConnectionStub,
$this->assetKeywordFactoryStub,
$this->loggerMock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Magento\Framework\DB\Adapter\Pdo\Mysql;
use Magento\Framework\DB\Select;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\MediaGallery\Model\ResourceModel\Keyword\SaveAssetsKeywords as SaveAssetKeywords;
use Magento\MediaGallery\Model\ResourceModel\Keyword\SaveAssetsKeywords;
use Magento\MediaGallery\Model\ResourceModel\Keyword\SaveAssetLinks;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -21,7 +21,7 @@
class SaveAssetKeywordsTest extends TestCase
{
/**
* @var SaveAssetKeywords
* @var SaveAssetsKeywords
*/
private $sut;

Expand Down Expand Up @@ -63,7 +63,7 @@ protected function setUp(): void
$this->selectMock = $this->createMock(Select::class);
$this->loggerMock = $this->getMockForAbstractClass(LoggerInterface::class);

$this->sut = new SaveAssetKeywords(
$this->sut = new SaveAssetsKeywords(
$this->resourceConnectionMock,
$this->saveAssetLinksMock,
$this->loggerMock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\State\InvalidTransitionException;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\Payment\Gateway\ConfigInterface as PaymentConfigInterface;
use Magento\Payment\Gateway\ConfigInterfaceFactory as PaymentConfigInterfaceFactory;
use Magento\Payment\Gateway\ConfigInterface;
use Magento\Payment\Gateway\ConfigInterfaceFactory;
use Magento\Paypal\Model\Cart as PayPalCart;
use Magento\Paypal\Model\CartFactory as PayPalCartFactory;
use Magento\Paypal\Model\Payflow\Service\Gateway as PayPalPayflowGateway;
Expand Down Expand Up @@ -44,7 +44,7 @@ class TransparentTest extends TestCase
private $subject;

/**
* @var PaymentConfigInterface|MockObject
* @var ConfigInterface|MockObject
*/
private $paymentConfig;

Expand Down Expand Up @@ -172,15 +172,15 @@ public function validAuthorizeRequestDataProvider(): array
}

/**
* @return PaymentConfigInterfaceFactory|MockObject
* @return ConfigInterfaceFactory|MockObject
*/
private function getPaymentConfigInterfaceFactory()
{
$paymentConfigInterfaceFactory = $this->getMockBuilder(PaymentConfigInterfaceFactory::class)
$paymentConfigInterfaceFactory = $this->getMockBuilder(ConfigInterfaceFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();
$this->paymentConfig = $this->getMockBuilder(PaymentConfigInterface::class)
$this->paymentConfig = $this->getMockBuilder(ConfigInterface::class)
->setMethods(['setStoreId', 'setMethodInstance', 'setMethod', 'getBuildNotationCode'])
->getMockForAbstractClass();

Expand Down
Loading

0 comments on commit a2352c1

Please sign in to comment.