devel_wizard-2.x-dev/tests/src/Kernel/Plugin/DevelWizard/Spell/EntityTypeGroupSpellTest.php
tests/src/Kernel/Plugin/DevelWizard/Spell/EntityTypeGroupSpellTest.php
<?php
declare(strict_types=1);
namespace Drupal\Tests\devel_wizard\Kernel\Plugin\DevelWizard\Spell;
use Drupal\Tests\devel_wizard\Traits\TemplateTrait;
class EntityTypeGroupSpellTest extends SpellTestBase {
use TemplateTrait;
/**
* {@inheritdoc}
*/
public static $modules = [
'devel_wizard',
'node',
];
public function casesTemplateModulePhp(): array {
return $this->collectTemplateCases('spell/entity_type_group/module.php.twig');
}
/**
* @dataProvider casesTemplateModulePhp
*/
public function testTemplateModulePhp(string $expected, string $template, array $context): void {
$container = \Drupal::getContainer();
$etm = $container->get('entity_type.manager');
$context['configEntityType']['definition'] = $etm->getDefinition($context['configEntityType']['id']);
$context['contentEntityType']['definition'] = $etm->getDefinition($context['contentEntityType']['id']);
/** @var \Drupal\Core\Template\TwigEnvironment $twig */
$twig = \Drupal::getContainer()->get('twig');
static::assertSame(
$expected,
$twig->render($template, $context),
);
}
}
