/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php
72 строки
2 KB
Raj Mohan R
AC-16236::Upgrade Core Test Framework to PHPUnit 12 and Migrate from PHPUnit 10
11 фев 2026, 13:51
11 фев 2026, 13:51
152ed41
Код
Авторство
О чём код?
<?php /** * Copyright 2013 Adobe * All Rights Reserved. */ namespace Magento\Sales\Block\Order; use PHPUnit\Framework\Attributes\DataProvider; class CommentsTest extends \PHPUnit\Framework\TestCase { /** * @var \Magento\Sales\Block\Order\Comments */ protected $_block; protected function setUp(): void { $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( \Magento\Framework\View\LayoutInterface::class )->createBlock( \Magento\Sales\Block\Order\Comments::class ); } /** * @param string $commentedEntity * @param string $expectedClass */ #[DataProvider('getCommentsDataProvider')] public function testGetComments($commentedEntity, $expectedClass) { $commentedEntity = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create($commentedEntity); $this->_block->setEntity($commentedEntity); $comments = $this->_block->getComments(); $this->assertInstanceOf($expectedClass, $comments); } /** * @return array */ public static function getCommentsDataProvider(): array { return [ [ \Magento\Sales\Model\Order\Invoice::class, \Magento\Sales\Model\ResourceModel\Order\Invoice\Comment\Collection::class, ], [ \Magento\Sales\Model\Order\Creditmemo::class, \Magento\Sales\Model\ResourceModel\Order\Creditmemo\Comment\Collection::class ], [ \Magento\Sales\Model\Order\Shipment::class, \Magento\Sales\Model\ResourceModel\Order\Shipment\Comment\Collection::class ] ]; } /** */ public function testGetCommentsWrongEntityException() { $this->expectException(\Magento\Framework\Exception\LocalizedException::class); $entity = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Catalog\Model\Product::class ); $this->_block->setEntity($entity); $this->_block->getComments(); } }