File tree Expand file tree Collapse file tree 7 files changed +29
-13
lines changed
dev/tests/integration/testsuite/Magento
Block/Product/ListProduct Expand file tree Collapse file tree 7 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ class CheckProductPriceTest extends TestCase
50
50
protected function setUp ()
51
51
{
52
52
$ this ->objectManager = Bootstrap::getObjectManager ();
53
- $ this ->pageFactory = $ this ->objectManager ->create (PageFactory::class);
54
- $ this ->productRepository = $ this ->objectManager ->create (ProductRepositoryInterface::class);
53
+ $ this ->pageFactory = $ this ->objectManager ->get (PageFactory::class);
54
+ $ this ->productRepository = $ this ->objectManager ->get (ProductRepositoryInterface::class);
55
55
$ this ->customerSession = $ this ->objectManager ->create (Session::class);
56
56
parent ::setUp ();
57
57
}
@@ -140,10 +140,7 @@ public function testCheckFixedTierPriceForLoggedUser(): void
140
140
{
141
141
$ priceHtml = $ this ->getProductPriceHtml ('simple_product ' );
142
142
$ this ->assertFinalPrice ($ priceHtml , 50.00 );
143
- $ this ->assertNotRegExp (
144
- '/\$10/ ' ,
145
- $ priceHtml
146
- );
143
+ $ this ->assertNotRegExp ('/\$10/ ' , $ priceHtml );
147
144
$ this ->customerSession ->setCustomerId (1 );
148
145
try {
149
146
$ priceHtml = $ this ->getProductPriceHtml ('simple_product ' );
@@ -299,7 +296,7 @@ private function getProductPriceHtml(string $sku): string
299
296
*/
300
297
private function getListProductBlock (): ListProduct
301
298
{
302
- $ page = $ this ->pageFactory ->create (PageFactory::class );
299
+ $ page = $ this ->pageFactory ->create ();
303
300
$ page ->addHandle ([
304
301
'default ' ,
305
302
'catalog_category_view ' ,
Original file line number Diff line number Diff line change 7
7
8
8
use Magento \Catalog \Api \Data \ProductTierPriceExtensionFactory ;
9
9
use Magento \Catalog \Api \Data \ProductTierPriceInterfaceFactory ;
10
- use Magento \Customer \Model \Group ;
11
10
use Magento \Store \Api \WebsiteRepositoryInterface ;
12
11
13
12
require __DIR__ . '/product_simple_without_price_configurations.php ' ;
Original file line number Diff line number Diff line change 12
12
use Magento \Catalog \Model \Product \Attribute \Source \Status ;
13
13
use Magento \Catalog \Model \Product \Type ;
14
14
use Magento \Catalog \Model \Product \Visibility ;
15
+ use Magento \Store \Model \WebsiteRepository ;
15
16
use Magento \TestFramework \Helper \Bootstrap ;
16
17
use Magento \TestFramework \ObjectManager ;
17
18
18
19
/** @var ObjectManager $objectManager */
19
20
$ objectManager = Bootstrap::getObjectManager ();
21
+ /** @var WebsiteRepository $websiteRepository */
22
+ $ websiteRepository = $ objectManager ->get (WebsiteRepository::class);
23
+ $ baseWebsite = $ websiteRepository ->get ('base ' );
20
24
/** @var ProductInterface $productModel */
21
25
$ productModel = $ objectManager ->get (ProductInterface::class);
22
26
/** @var ProductInterfaceFactory $productFactory */
28
32
'data ' => [
29
33
'type_id ' => Type::TYPE_SIMPLE ,
30
34
'attribute_set_id ' => $ productModel ->getDefaultAttributeSetid (),
31
- 'website_ids ' => [1 ],
35
+ 'website_ids ' => [$ baseWebsite -> getId () ],
32
36
'name ' => 'Simple product ' ,
33
37
'sku ' => 'simple_product ' ,
34
38
'price ' => 50 ,
Original file line number Diff line number Diff line change 10
10
use Magento \CatalogRule \Api \Data \RuleInterfaceFactory ;
11
11
use Magento \CatalogRule \Model \Indexer \IndexBuilder ;
12
12
use Magento \Customer \Model \Group ;
13
+ use Magento \Store \Model \WebsiteRepository ;
13
14
use Magento \TestFramework \Helper \Bootstrap ;
14
15
15
16
$ objectManager = Bootstrap::getObjectManager ();
17
+ /** @var WebsiteRepository $websiteRepository */
18
+ $ websiteRepository = $ objectManager ->get (WebsiteRepository::class);
19
+ $ baseWebsite = $ websiteRepository ->get ('base ' );
16
20
/** @var IndexBuilder $indexBuilder */
17
21
$ indexBuilder = $ objectManager ->get (IndexBuilder::class);
18
22
/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */
26
30
RuleInterface::NAME => 'Test Catalog Rule for not logged user ' ,
27
31
'customer_group_ids ' => Group::NOT_LOGGED_IN_ID ,
28
32
RuleInterface::DISCOUNT_AMOUNT => 10 ,
29
- 'website_ids ' => [1 ],
33
+ 'website_ids ' => [$ baseWebsite -> getId () ],
30
34
RuleInterface::SIMPLE_ACTION => 'to_fixed ' ,
31
35
RuleInterface::STOP_RULES_PROCESSING => false ,
32
36
RuleInterface::SORT_ORDER => 0 ,
Original file line number Diff line number Diff line change 10
10
use Magento \CatalogRule \Api \Data \RuleInterfaceFactory ;
11
11
use Magento \CatalogRule \Model \Indexer \IndexBuilder ;
12
12
use Magento \Customer \Model \Group ;
13
+ use Magento \Store \Model \WebsiteRepository ;
13
14
use Magento \TestFramework \Helper \Bootstrap ;
14
15
15
16
$ objectManager = Bootstrap::getObjectManager ();
17
+ /** @var WebsiteRepository $websiteRepository */
18
+ $ websiteRepository = $ objectManager ->get (WebsiteRepository::class);
19
+ $ baseWebsite = $ websiteRepository ->get ('base ' );
16
20
/** @var IndexBuilder $indexBuilder */
17
21
$ indexBuilder = $ objectManager ->get (IndexBuilder::class);
18
22
/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */
26
30
RuleInterface::NAME => 'Test Catalog Rule for not logged user ' ,
27
31
'customer_group_ids ' => Group::NOT_LOGGED_IN_ID ,
28
32
RuleInterface::DISCOUNT_AMOUNT => 10 ,
29
- 'website_ids ' => [1 ],
33
+ 'website_ids ' => [$ baseWebsite -> getId () ],
30
34
RuleInterface::SIMPLE_ACTION => 'to_percent ' ,
31
35
RuleInterface::STOP_RULES_PROCESSING => false ,
32
36
RuleInterface::SORT_ORDER => 0 ,
Original file line number Diff line number Diff line change 10
10
use Magento \CatalogRule \Api \Data \RuleInterfaceFactory ;
11
11
use Magento \CatalogRule \Model \Indexer \IndexBuilder ;
12
12
use Magento \Customer \Model \Group ;
13
+ use Magento \Store \Model \WebsiteRepository ;
13
14
use Magento \TestFramework \Helper \Bootstrap ;
14
15
15
16
$ objectManager = Bootstrap::getObjectManager ();
17
+ /** @var WebsiteRepository $websiteRepository */
18
+ $ websiteRepository = $ objectManager ->get (WebsiteRepository::class);
19
+ $ baseWebsite = $ websiteRepository ->get ('base ' );
16
20
/** @var IndexBuilder $indexBuilder */
17
21
$ indexBuilder = $ objectManager ->get (IndexBuilder::class);
18
22
/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */
26
30
RuleInterface::NAME => 'Test Catalog Rule for not logged user ' ,
27
31
'customer_group_ids ' => Group::NOT_LOGGED_IN_ID ,
28
32
RuleInterface::DISCOUNT_AMOUNT => 10 ,
29
- 'website_ids ' => [1 ],
33
+ 'website_ids ' => [$ baseWebsite -> getId () ],
30
34
RuleInterface::SIMPLE_ACTION => 'by_fixed ' ,
31
35
RuleInterface::STOP_RULES_PROCESSING => false ,
32
36
RuleInterface::SORT_ORDER => 0 ,
Original file line number Diff line number Diff line change 10
10
use Magento \CatalogRule \Api \Data \RuleInterfaceFactory ;
11
11
use Magento \CatalogRule \Model \Indexer \IndexBuilder ;
12
12
use Magento \Customer \Model \Group ;
13
+ use Magento \Store \Model \WebsiteRepository ;
13
14
use Magento \TestFramework \Helper \Bootstrap ;
14
15
15
16
$ objectManager = Bootstrap::getObjectManager ();
17
+ /** @var WebsiteRepository $websiteRepository */
18
+ $ websiteRepository = $ objectManager ->get (WebsiteRepository::class);
19
+ $ baseWebsite = $ websiteRepository ->get ('base ' );
16
20
/** @var IndexBuilder $indexBuilder */
17
21
$ indexBuilder = $ objectManager ->get (IndexBuilder::class);
18
22
/** @var CatalogRuleRepositoryInterface $catalogRuleRepository */
26
30
RuleInterface::NAME => 'Test Catalog Rule for not logged user ' ,
27
31
'customer_group_ids ' => Group::NOT_LOGGED_IN_ID ,
28
32
RuleInterface::DISCOUNT_AMOUNT => 10 ,
29
- 'website_ids ' => [1 ],
33
+ 'website_ids ' => [$ baseWebsite -> getId () ],
30
34
RuleInterface::SIMPLE_ACTION => 'by_percent ' ,
31
35
RuleInterface::STOP_RULES_PROCESSING => false ,
32
36
RuleInterface::SORT_ORDER => 0 ,
You can’t perform that action at this time.
0 commit comments