woocommerce-paypal-payments/tests/PHPUnit/StatusReport/RendererTest.php

36 lines
1 KiB
PHP
Raw Normal View History

2021-07-22 15:39:57 +02:00
<?php
declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\StatusReport;
use WooCommerce\PayPalCommerce\TestCase;
use function Brain\Monkey\Functions\when;
class RendererTest extends TestCase
{
public function testRender()
{
$items = [
[
2021-11-25 12:42:18 +02:00
'label' => 'Translated Foo',
'exported_label' => 'Foo',
2021-07-28 12:51:00 +02:00
'description' => 'Bar',
'value' => 'Baz'
2021-07-22 15:39:57 +02:00
],
];
when('esc_attr')->returnArg();
2021-11-25 12:42:18 +02:00
when('wp_kses_post')->returnArg();
2021-07-28 12:51:00 +02:00
when('wc_help_tip')->returnArg();
2021-07-22 15:39:57 +02:00
$testee = new Renderer();
$result = $testee->render('Some title here', $items);
self::assertStringContainsString('<h2>Some title here</h2>', $result);
2021-11-25 12:42:18 +02:00
self::assertStringContainsString('data-export-label="Foo"', $result);
self::assertStringContainsString('Translated Foo', $result);
2021-07-28 12:51:00 +02:00
self::assertStringContainsString('<td class="help">Bar</td>', $result);
self::assertStringContainsString('<td>Baz</td>', $result);
2021-07-22 15:39:57 +02:00
}
2021-07-28 12:51:00 +02:00
}