wishthis/vendor/qferr/mjml-php/tests/Renderer/ApiRendererTests.php
2022-11-28 11:29:52 +01:00

30 lines
759 B
PHP

<?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);
}
}