3 namespace Drupal\Tests\paragraphs\Kernel;
5 use Drupal\KernelTests\KernelTestBase;
6 use Drupal\paragraphs\Entity\ParagraphsType;
9 * Tests the ParagraphsType entity hasEnabledBehaviorPlugin functionality.
13 class ParagraphsTypeHasEnabledBehaviorPluginTest extends KernelTestBase {
21 public static $modules = [
28 * ParagraphsType entity build in setUp()
32 protected $paragraphsType;
37 protected function setUp() {
39 $this->installEntitySchema('user');
40 $this->installEntitySchema('paragraph');
41 \Drupal::moduleHandler()->loadInclude('paragraphs', 'install');
43 // Create a paragraph with an enabled and disabled plugin.
44 $this->paragraphsType = ParagraphsType::create([
45 'label' => 'test_text',
47 'behavior_plugins' => [
48 'test_text_color' => [
51 'test_dummy_behavior' => [
56 $this->paragraphsType->save();
60 * Tests the behavior settings API.
62 public function testValidPluginIds() {
63 $this->assertTrue($this->paragraphsType->hasEnabledBehaviorPlugin('test_text_color'));
64 $this->assertFalse($this->paragraphsType->hasEnabledBehaviorPlugin('test_dummy_behavior'));
68 * Test that invalid plugin id's return false.
70 public function testInvalidPluginId() {
71 $this->assertFalse($this->paragraphsType->hasEnabledBehaviorPlugin('i_do_not_exist'));