Skip to content

Commit dcccb50

Browse files
committed
AC-15345: Undefined array key in ProductRepository getById
Integration test coverage
1 parent a087de5 commit dcccb50

File tree

1 file changed

+26
-2
lines changed
  • dev/tests/integration/testsuite/Magento/Review/Block

1 file changed

+26
-2
lines changed

dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2017 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Review\Block;
88

9+
use Magento\Catalog\Test\Fixture\Product as ProductFixture;
910
use Magento\Framework\App\Area;
1011
use Magento\Framework\App\Config\Value;
1112
use Magento\Framework\App\ReinitableConfig;
13+
use Magento\Framework\App\Request\Http;
1214
use Magento\Framework\App\State;
1315
use Magento\Framework\View\Element\ButtonLockManager;
16+
use Magento\TestFramework\Fixture\AppArea;
17+
use Magento\TestFramework\Fixture\DataFixture;
18+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
1419
use Magento\TestFramework\ObjectManager;
1520

1621
class FormTest extends \PHPUnit\Framework\TestCase
@@ -83,6 +88,25 @@ public static function getCorrectFlagDataProvider()
8388
];
8489
}
8590

91+
#[
92+
AppArea('frontend'),
93+
DataFixture(ProductFixture::class, as: 'product'),
94+
]
95+
public function testGetProductInfo()
96+
{
97+
$fixtures = DataFixtureStorageManager::getStorage();
98+
$product = $fixtures->get('product');
99+
100+
$form = $this->objectManager->create(Form::class);
101+
$form->getRequest()
102+
->setMethod(Http::METHOD_GET)
103+
->setParams(['id' => $product->getId() . "abc"]);
104+
105+
$productInfo = $form->getProductInfo();
106+
$this->assertEquals($product->getId(), $productInfo->getId());
107+
$this->assertEquals($product->getSku(), $productInfo->getSku());
108+
}
109+
86110
private function getObjectManager()
87111
{
88112
return \Magento\TestFramework\Helper\Bootstrap::getObjectManager();

0 commit comments

Comments
 (0)