|
1 | 1 | <?php
|
2 | 2 | /**
|
3 |
| - * Copyright © Magento, Inc. All rights reserved. |
4 |
| - * See COPYING.txt for license details. |
| 3 | + * Copyright 2017 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */
|
6 | 6 |
|
7 | 7 | namespace Magento\Review\Block;
|
8 | 8 |
|
| 9 | +use Magento\Catalog\Test\Fixture\Product as ProductFixture; |
9 | 10 | use Magento\Framework\App\Area;
|
10 | 11 | use Magento\Framework\App\Config\Value;
|
11 | 12 | use Magento\Framework\App\ReinitableConfig;
|
| 13 | +use Magento\Framework\App\Request\Http; |
12 | 14 | use Magento\Framework\App\State;
|
13 | 15 | use Magento\Framework\View\Element\ButtonLockManager;
|
| 16 | +use Magento\TestFramework\Fixture\AppArea; |
| 17 | +use Magento\TestFramework\Fixture\DataFixture; |
| 18 | +use Magento\TestFramework\Fixture\DataFixtureStorageManager; |
14 | 19 | use Magento\TestFramework\ObjectManager;
|
15 | 20 |
|
16 | 21 | class FormTest extends \PHPUnit\Framework\TestCase
|
@@ -83,6 +88,25 @@ public static function getCorrectFlagDataProvider()
|
83 | 88 | ];
|
84 | 89 | }
|
85 | 90 |
|
| 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 | + |
86 | 110 | private function getObjectManager()
|
87 | 111 | {
|
88 | 112 | return \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
|
|
0 commit comments