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 = [
29 * ParagraphsType entity build in setUp()
33 protected $paragraphsType;
38 protected function setUp() {
40 $this->installEntitySchema('user');
41 $this->installEntitySchema('paragraph');
42 \Drupal::moduleHandler()->loadInclude('paragraphs', 'install');
44 // Create a paragraph with an enabled and disabled plugin.
45 $this->paragraphsType = ParagraphsType::create([
46 'label' => 'test_text',
48 'behavior_plugins' => [
49 'test_text_color' => [
52 'test_dummy_behavior' => [
57 $this->paragraphsType->save();
61 * Tests the behavior settings API.
63 public function testValidPluginIds() {
64 $this->assertTrue($this->paragraphsType->hasEnabledBehaviorPlugin('test_text_color'));
65 $this->assertFalse($this->paragraphsType->hasEnabledBehaviorPlugin('test_dummy_behavior'));
69 * Test that invalid plugin id's return false.
71 public function testInvalidPluginId() {
72 $this->assertFalse($this->paragraphsType->hasEnabledBehaviorPlugin('i_do_not_exist'));