wishthis/vendor/qferr/mjml-php/tests/Renderer/ApiRendererTests.php

31 lines
759 B
PHP
Raw Normal View History

2022-11-28 10:29:52 +00:00
<?php
namespace Qferrer\Tests\Mjml\Renderer;
use PHPUnit\Framework\TestCase;
use Qferrer\Mjml\ApiInterface;
use Qferrer\Mjml\Http\CurlApi;
use Qferrer\Mjml\Renderer\ApiRenderer;
class ApiRendererTests extends TestCase
{
private $httpClient;
private $apiRenderer;
protected function setUp(): void
{
$this->httpClient = $this->createMock(ApiInterface::class);
$this->apiRenderer = new ApiRenderer($this->httpClient);
}
public function testRender()
{
$expectedHtml = '<p>Test</p>';
$this->httpClient->expects($this->once())->method('getHtml')->willReturn($expectedHtml);
$html = $this->apiRenderer->render('<mjml>Test</mjml>');
$this->assertEquals($expectedHtml, $html);
}
}