Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Catalog
Controller
Adminhtml
Product
GetSelectedTest.php
Go to the documentation of this file.
1
<?php
7
declare(strict_types=1);
8
9
namespace
Magento\Catalog\Controller\Adminhtml\Product
;
10
14
class
GetSelectedTest
extends
\Magento\TestFramework\TestCase\AbstractBackendController
15
{
19
public
function
testExecute
() : void
20
{
21
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
22
$productRepository
=
$objectManager
->get(\
Magento
\Catalog\Api\ProductRepositoryInterface::class);
23
24
$product
=
$productRepository
->get(
'simple'
);
25
$this->
getRequest
()
26
->setPostValue(
'productId'
,
$product
->getId());
27
$this->
dispatch
(
'backend/catalog/product/getSelected'
);
28
$responseBody = $this->
getResponse
()->getBody();
29
$this->assertContains(
30
'{"value":"1","label":"Simple Product","is_active":1,"path":"simple"}'
,
31
$responseBody
32
);
33
}
34
35
public
function
testExecuteNonExistingSearchKey
() : void
36
{
37
$this->
getRequest
()
38
->setPostValue(
'productId'
,
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
);
39
$this->
dispatch
(
'backend/catalog/product/getSelected'
);
40
$responseBody = $this->
getResponse
()->getBody();
41
$this->assertContains(
'[]'
, $responseBody);
42
}
43
}
Magento\TestFramework\TestCase\AbstractController\getRequest
getRequest()
Definition:
AbstractController.php:124
Magento\Catalog\Controller\Adminhtml\Product\GetSelectedTest\testExecuteNonExistingSearchKey
testExecuteNonExistingSearchKey()
Definition:
GetSelectedTest.php:35
$objectManager
$objectManager
Definition:
bootstrap.php:17
$productRepository
$productRepository
Definition:
bundle_product_with_not_visible_children.php:18
Magento\Catalog\Controller\Adminhtml\Product\GetSelectedTest\testExecute
testExecute()
Definition:
GetSelectedTest.php:19
Magento\Catalog\Controller\Adminhtml\Product
Magento\TestFramework\TestCase\AbstractController\getResponse
getResponse()
Definition:
AbstractController.php:137
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Catalog\Controller\Adminhtml\Product\GetSelectedTest
Definition:
GetSelectedTest.php:14
Magento\Backend\App\AbstractAction\dispatch
dispatch(\Magento\Framework\App\RequestInterface $request)
Definition:
AbstractAction.php:206
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125
Magento\TestFramework\TestCase\AbstractBackendController
Definition:
AbstractBackendController.php:15