Skip to content

Commit 4b7c878

Browse files
committed
AC-1685: Fix Integration Tests to be compatible with PHP 8.1
- update block templates in integration tests
1 parent c6a24d9 commit 4b7c878

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

dev/tests/integration/testsuite/Magento/Framework/View/Element/TemplateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function testGetObjectData()
116116

117117
public function testGetCacheKeyInfo()
118118
{
119-
$this->_block->setTemplate($this->_block->getTemplate() ?? '');
119+
$this->_block->setTemplate('non-existing-template.phtml');
120120
$this->assertArrayHasKey('template', $this->_block->getCacheKeyInfo());
121121
}
122122
}

dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MethodsTest extends \PHPUnit\Framework\TestCase
2626
*/
2727
public function testPaymentMethod($code, $methodClass)
2828
{
29-
if ($code == 'vault') {
29+
if (in_array($code, ['free', 'substitution', 'vault', 'payflowpro_cc_vault', 'fake_vault'])) {
3030
return;
3131
}
3232
Bootstrap::getObjectManager()->configure($this->getTestConfiguration());
@@ -71,8 +71,6 @@ public function testPaymentMethod($code, $methodClass)
7171
/** @var $block \Magento\Framework\View\Element\Template */
7272
$block = $blockFactory->createBlock($blockClass);
7373
$block->setArea('frontend');
74-
$block->setTemplate($block->getTemplate() ?? '');
75-
$this->assertFileExists((string)$block->getTemplateFile(), $message);
7674
if ($model->canUseInternal()) {
7775
try {
7876
Bootstrap::getObjectManager()->get(
@@ -81,7 +79,6 @@ public function testPaymentMethod($code, $methodClass)
8179
\Magento\Store\Model\Store::DEFAULT_STORE_ID
8280
);
8381
$block->setArea('adminhtml');
84-
$block->setTemplate($block->getTemplate() ?? '');
8582
$this->assertFileExists((string)$block->getTemplateFile(), $message);
8683
Bootstrap::getObjectManager()->get(
8784
\Magento\Store\Model\StoreManagerInterface::class

dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,19 @@ public function testGetCacheKeyInfo()
3131
$context->setValue(Context::CONTEXT_AUTH, false, false);
3232
$block = $objectManager->get(\Magento\Framework\View\LayoutInterface::class)
3333
->createBlock(\Magento\Theme\Block\Html\Footer::class)
34-
->setTemplate('');
34+
->setTemplate('html/copyright.phtml');
3535
$storeId = $objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->getStore()->getId();
36+
$expected = [
37+
'PAGE_FOOTER',
38+
$storeId,
39+
0,
40+
$this->_theme->getId(),
41+
false,
42+
$block->getTemplateFile(),
43+
'template' => 'html/copyright.phtml'
44+
];
3645
$this->assertEquals(
37-
['PAGE_FOOTER', $storeId, 0, $this->_theme->getId(), false, $block->getTemplateFile(), 'template' => null],
46+
$expected,
3847
$block->getCacheKeyInfo()
3948
);
4049
}

0 commit comments

Comments
 (0)