Skip to content

Commit 07e92d7

Browse files
committed
Use php74 versions of tests
1 parent d55da1e commit 07e92d7

File tree

6 files changed

+58
-13
lines changed

6 files changed

+58
-13
lines changed

dev/tests/integration/testsuite/Magento/Customer/Model/CustomerRegistryTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class CustomerRegistryTest extends TestCase
4949
/**
5050
* @inheritdoc
5151
*/
52-
protected function setUp()
52+
protected function setUp(): void
5353
{
5454
parent::setUp();
5555

@@ -110,6 +110,7 @@ public function testRetrieveException(): void
110110
$customerId = 1;
111111
$this->expectException(NoSuchEntityException::class);
112112
$this->expectExceptionMessage(sprintf('No such entity with customerId = %s', $customerId));
113+
113114
$this->model->retrieve($customerId);
114115
}
115116

@@ -133,12 +134,12 @@ public function testRetrieveEmailException(): void
133134
*/
134135
public function testRemove(): void
135136
{
137+
$this->expectException(NoSuchEntityException::class);
136138
$customerId = 1;
137139
$customer = $this->model->retrieve($customerId);
138140
$this->assertInstanceOf(Customer::class, $customer);
139141
$this->customerResourceModel->delete($customer);
140142
$this->model->remove($customerId);
141-
$this->expectException(NoSuchEntityException::class);
142143
$this->model->retrieve($customerId);
143144
}
144145

@@ -150,12 +151,12 @@ public function testRemove(): void
150151
*/
151152
public function testRemoveByEmail(): void
152153
{
154+
$this->expectException(NoSuchEntityException::class);
153155
$email = '[email protected]';
154156
$customer = $this->model->retrieve(1);
155157
$this->assertInstanceOf(Customer::class, $customer);
156158
$this->customerResourceModel->delete($customer);
157159
$this->model->removeByEmail($email, $this->defaultWebsiteId);
158-
$this->expectException(NoSuchEntityException::class);
159160
$this->model->retrieveByEmail($email, $customer->getWebsiteId());
160161
}
161162

dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,30 @@
88
namespace Magento\Review\Controller\Adminhtml\Customer;
99

1010
use Magento\Framework\App\Request\Http;
11+
use Magento\Framework\App\Request\Http as HttpRequest;
12+
use Magento\Framework\View\LayoutInterface;
1113
use Magento\TestFramework\TestCase\AbstractBackendController;
1214

1315
/**
1416
* Test for customer product reviews page.
17+
*
18+
* @magentoAppArea adminhtml
1519
*/
1620
class ProductReviewsTest extends AbstractBackendController
1721
{
22+
/** @var LayoutInterface */
23+
private $layout;
24+
25+
/**
26+
* @inheritdoc
27+
*/
28+
protected function setUp(): void
29+
{
30+
parent::setUp();
31+
32+
$this->layout = $this->_objectManager->get(LayoutInterface::class);
33+
}
34+
1835
/**
1936
* Check Customer product review action.
2037
*
@@ -23,9 +40,36 @@ class ProductReviewsTest extends AbstractBackendController
2340
*/
2441
public function testProductReviewsAction(): void
2542
{
26-
$this->getRequest()->setPostValue(['id' => 1])->setMethod(Http::METHOD_POST);
43+
$this->dispatchWithIdParam(1);
44+
$this->assertContains('<div id="reviewGrid"', $this->getResponse()->getBody());
45+
}
46+
47+
/**
48+
* @return void
49+
*/
50+
public function testProductReviews(): void
51+
{
52+
$customerId = 1;
53+
$this->dispatchWithIdParam($customerId);
54+
$block = $this->layout->getBlock('admin.customer.reviews');
55+
$this->assertNotFalse($block);
56+
$this->assertEquals(
57+
$customerId,
58+
$block->getCustomerId(),
59+
'Block customer id value does not match expected value'
60+
);
61+
}
62+
63+
/**
64+
* Dispatch request with id parameter
65+
*
66+
* @param int $id
67+
* @return void
68+
*/
69+
private function dispatchWithIdParam(int $id): void
70+
{
71+
$this->getRequest()->setMethod(HttpRequest::METHOD_POST);
72+
$this->getRequest()->setParams(['id' => $id]);
2773
$this->dispatch('backend/review/customer/productReviews');
28-
$body = $this->getResponse()->getBody();
29-
$this->assertStringContainsString('<div id="reviewGrid"', $body);
3074
}
3175
}

dev/tests/integration/testsuite/Magento/Sales/Block/Order/Creditmemo/ItemsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ItemsTest extends TestCase
5252
/**
5353
* @inheritdoc
5454
*/
55-
protected function setUp()
55+
protected function setUp(): void
5656
{
5757
parent::setUp();
5858

@@ -68,7 +68,7 @@ protected function setUp()
6868
/**
6969
* @inheritdoc
7070
*/
71-
protected function tearDown()
71+
protected function tearDown(): void
7272
{
7373
$this->registry->unregister('current_order');
7474

dev/tests/integration/testsuite/Magento/Sales/Block/Order/Invoice/ItemsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ItemsTest extends TestCase
5353
/**
5454
* @inheritdoc
5555
*/
56-
protected function setUp()
56+
protected function setUp(): void
5757
{
5858
$this->objectManager = Bootstrap::getObjectManager();
5959
$this->registry = $this->objectManager->get(Registry::class);
@@ -67,7 +67,7 @@ protected function setUp()
6767
/**
6868
* @inheritdoc
6969
*/
70-
protected function tearDown()
70+
protected function tearDown(): void
7171
{
7272
$this->registry->unregister('current_order');
7373

dev/tests/integration/testsuite/Magento/Sales/Block/Order/ItemsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ItemsTest extends TestCase
4949
/**
5050
* @inheritdoc
5151
*/
52-
protected function setUp()
52+
protected function setUp(): void
5353
{
5454
$this->objectManager = Bootstrap::getObjectManager();
5555
$this->layout = $this->objectManager->get(LayoutInterface::class);
@@ -61,7 +61,7 @@ protected function setUp()
6161
/**
6262
* @inheritdoc
6363
*/
64-
protected function tearDown()
64+
protected function tearDown(): void
6565
{
6666
$this->registry->unregister('current_order');
6767

dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/lib/internal/Magento/Framework/Test/Unit/View/Element/UiComponentFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class UiComponentFactoryTest extends \PHPUnit\Framework\TestCase
3232
/** @var \Magento\Ui\Config\Reader\Definition\Data|MockObject */
3333
protected $dataMock;
3434

35-
protected function setUp()
35+
protected function setUp(): void
3636
{
3737
$this->objectManagerMock = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class)
3838
->getMockForAbstractClass();

0 commit comments

Comments
 (0)