|
5 | 5 | */
|
6 | 6 | namespace Magento\Payment\Block;
|
7 | 7 |
|
| 8 | +use Magento\Framework\View\Element\Text; |
| 9 | +use Magento\Framework\View\LayoutInterface; |
| 10 | +use Magento\OfflinePayments\Model\Banktransfer; |
| 11 | +use Magento\OfflinePayments\Model\Checkmo; |
| 12 | +use Magento\Payment\Block\Info as BlockInfo; |
| 13 | +use Magento\Payment\Block\Info\Instructions; |
| 14 | +use Magento\Payment\Model\Info; |
| 15 | +use Magento\Sales\Model\Order; |
| 16 | +use Magento\TestFramework\Helper\Bootstrap; |
| 17 | + |
| 18 | +/** |
| 19 | + * Class InfoTest |
| 20 | + */ |
8 | 21 | class InfoTest extends \PHPUnit\Framework\TestCase
|
9 | 22 | {
|
10 | 23 | /**
|
| 24 | + * Tests payment info block. |
| 25 | + * |
11 | 26 | * @magentoConfigFixture current_store payment/banktransfer/title Bank Method Title
|
12 | 27 | * @magentoConfigFixture current_store payment/checkmo/title Checkmo Title Of The Method
|
13 | 28 | * @magentoAppArea adminhtml
|
14 | 29 | */
|
15 | 30 | public function testGetChildPdfAsArray()
|
16 | 31 | {
|
17 | 32 | /** @var $layout \Magento\Framework\View\Layout */
|
18 |
| - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( |
19 |
| - \Magento\Framework\View\LayoutInterface::class |
20 |
| - ); |
21 |
| - $block = $layout->createBlock(\Magento\Payment\Block\Info::class, 'block'); |
| 33 | + $layout = Bootstrap::getObjectManager()->get(LayoutInterface::class); |
| 34 | + $block = $layout->createBlock(BlockInfo::class, 'block'); |
22 | 35 |
|
23 |
| - /** @var $paymentInfoBank \Magento\Payment\Model\Info */ |
24 |
| - $paymentInfoBank = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( |
25 |
| - \Magento\Payment\Model\Info::class |
26 |
| - ); |
27 |
| - $paymentInfoBank->setMethodInstance( |
28 |
| - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( |
29 |
| - \Magento\OfflinePayments\Model\Banktransfer::class |
30 |
| - ) |
| 36 | + /** @var $paymentInfoBank Info */ |
| 37 | + $paymentInfoBank = Bootstrap::getObjectManager()->create( |
| 38 | + Info::class |
31 | 39 | );
|
32 |
| - /** @var $childBank \Magento\Payment\Block\Info\Instructions */ |
33 |
| - $childBank = $layout->addBlock(\Magento\Payment\Block\Info\Instructions::class, 'child.one', 'block'); |
| 40 | + $order = Bootstrap::getObjectManager()->create(Order::class); |
| 41 | + $banktransferPayment = Bootstrap::getObjectManager()->create(Banktransfer::class); |
| 42 | + $paymentInfoBank->setMethodInstance($banktransferPayment); |
| 43 | + $paymentInfoBank->setOrder($order); |
| 44 | + /** @var $childBank Instructions */ |
| 45 | + $childBank = $layout->addBlock(Instructions::class, 'child.one', 'block'); |
34 | 46 | $childBank->setInfo($paymentInfoBank);
|
35 | 47 |
|
36 | 48 | $nonExpectedHtml = 'non-expected html';
|
37 |
| - $childHtml = $layout->addBlock(\Magento\Framework\View\Element\Text::class, 'child.html', 'block'); |
| 49 | + $childHtml = $layout->addBlock(Text::class, 'child.html', 'block'); |
38 | 50 | $childHtml->setText($nonExpectedHtml);
|
39 | 51 |
|
40 |
| - /** @var $paymentInfoCheckmo \Magento\Payment\Model\Info */ |
41 |
| - $paymentInfoCheckmo = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( |
42 |
| - \Magento\Payment\Model\Info::class |
43 |
| - ); |
44 |
| - $paymentInfoCheckmo->setMethodInstance( |
45 |
| - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( |
46 |
| - \Magento\OfflinePayments\Model\Checkmo::class |
47 |
| - ) |
| 52 | + /** @var $paymentInfoCheckmo Info */ |
| 53 | + $paymentInfoCheckmo = Bootstrap::getObjectManager()->create( |
| 54 | + Info::class |
48 | 55 | );
|
| 56 | + $checkmoPayment = Bootstrap::getObjectManager()->create(Checkmo::class); |
| 57 | + $paymentInfoCheckmo->setMethodInstance($checkmoPayment); |
| 58 | + $paymentInfoCheckmo->setOrder($order); |
49 | 59 | /** @var $childCheckmo \Magento\OfflinePayments\Block\Info\Checkmo */
|
50 | 60 | $childCheckmo = $layout->addBlock(
|
51 | 61 | \Magento\OfflinePayments\Block\Info\Checkmo::class,
|
|
0 commit comments