This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,39 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Block\Adminhtml\Items;
/**
* @magentoAppArea adminhtml
*/
class AbstractTest extends \PHPUnit\Framework\TestCase
{
public function testGetItemExtraInfoHtml()
{
/** @var $layout \Magento\Framework\View\Layout */
$layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Framework\View\LayoutInterface::class
);
/** @var $block \Magento\Sales\Block\Adminhtml\Items\AbstractItems */
$block = $layout->createBlock(\Magento\Sales\Block\Adminhtml\Items\AbstractItems::class, 'block');
$item = new \Magento\Framework\DataObject();
$this->assertEmpty($block->getItemExtraInfoHtml($item));
$expectedHtml = '<html><body>some data</body></html>';
/** @var $childBlock \Magento\Framework\View\Element\Text */
$childBlock = $layout->addBlock(
\Magento\Framework\View\Element\Text::class,
'other_block',
'block',
'order_item_extra_info'
);
$childBlock->setText($expectedHtml);
$this->assertEquals($expectedHtml, $block->getItemExtraInfoHtml($item));
$this->assertSame($item, $childBlock->getItem());
}
}
@@ -0,0 +1,50 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Sales\Block\Adminhtml\Items\Column;
/**
* @magentoAppArea adminhtml
*/
class NameTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Name
*/
private $block;
protected function setUp(): void
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $layout \Magento\Framework\View\Layout */
$layout = $objectManager->create(\Magento\Framework\View\LayoutInterface::class);
/** @var $block \Magento\Sales\Block\Adminhtml\Items\AbstractItems */
$this->block = $layout->createBlock(Name::class, 'block');
}
public function testTruncateString() : void
{
$remainder = '';
$this->assertEquals(
'12345',
$this->block->truncateString('1234567890', 5, '', $remainder)
);
}
public function testGetFormattedOptiong() : void
{
$this->assertEquals(
[
'value' => '1234567890123456789012345678901234567890123456789012345',
'remainder' => '67890',
],
$this->block->getFormattedOption(
'123456789012345678901234567890123456789012345678901234567890'
)
);
}
}