Files
piratepoet/mailpoet/tests/integration/EmailEditor/Engine/Renderer/ContentRenderer/BlocksRegistryTest.php
Rostislav Wolny 76c60aa5e0 Update BlocksRegistryTest
- testItAllowsToReplaceRendererViaFilter is no longer needed as we removed the filter
- testItRemovesAllBlockRenderers this responsibility was moved to ContentRenderer
[MAILPOET-6014]
2024-05-01 11:15:27 +01:00

38 lines
1.1 KiB
PHP

<?php declare(strict_types = 1);
namespace MailPoet\EmailEditor\Engine\Renderer\ContentRenderer;
use MailPoet\EmailEditor\Integrations\Core\Renderer\Blocks\Text;
require_once __DIR__ . '/DummyBlockRenderer.php';
class BlocksRegistryTest extends \MailPoetTest {
/** @var BlocksRegistry */
private $registry;
public function _before() {
parent::_before();
$this->registry = $this->diContainer->get(BlocksRegistry::class);
}
public function testItReturnsNullForUnknownRenderer() {
$storedRenderer = $this->registry->getBlockRenderer('test');
verify($storedRenderer)->null();
}
public function testItStoresAddedRenderer() {
$renderer = new Text();
$this->registry->addBlockRenderer('test', $renderer);
$storedRenderer = $this->registry->getBlockRenderer('test');
verify($storedRenderer)->equals($renderer);
}
public function testItReportsWhichRenderersAreRegistered() {
$renderer = new Text();
$this->registry->addBlockRenderer('test', $renderer);
verify($this->registry->hasBlockRenderer('test'))->true();
verify($this->registry->hasBlockRenderer('unknown'))->false();
}
}