Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / paragraphs / tests / src / Kernel / ParagraphsTypeHasEnabledBehaviorPluginTest.php
1 <?php
2
3 namespace Drupal\Tests\paragraphs\Kernel;
4
5 use Drupal\KernelTests\KernelTestBase;
6 use Drupal\paragraphs\Entity\ParagraphsType;
7
8 /**
9  * Tests the ParagraphsType entity hasEnabledBehaviorPlugin functionality.
10  *
11  * @group paragraphs
12  */
13 class ParagraphsTypeHasEnabledBehaviorPluginTest extends KernelTestBase {
14
15
16   /**
17    * Modules to enable.
18    *
19    * @var array
20    */
21   public static $modules = [
22     'paragraphs',
23     'user',
24     'paragraphs_test',
25     'file',
26   ];
27
28   /**
29    * ParagraphsType entity build in setUp()
30    *
31    * @var ParagraphsType
32    */
33   protected $paragraphsType;
34
35   /**
36    * {@inheritdoc}
37    */
38   protected function setUp() {
39     parent::setUp();
40     $this->installEntitySchema('user');
41     $this->installEntitySchema('paragraph');
42     \Drupal::moduleHandler()->loadInclude('paragraphs', 'install');
43
44     // Create a paragraph with an enabled and disabled plugin.
45     $this->paragraphsType = ParagraphsType::create([
46       'label' => 'test_text',
47       'id' => 'test_text',
48       'behavior_plugins' => [
49         'test_text_color' => [
50           'enabled' => TRUE,
51         ],
52         'test_dummy_behavior' => [
53           'enabled' => FALSE,
54         ],
55       ],
56     ]);
57     $this->paragraphsType->save();
58   }
59
60   /**
61    * Tests the behavior settings API.
62    */
63   public function testValidPluginIds() {
64     $this->assertTrue($this->paragraphsType->hasEnabledBehaviorPlugin('test_text_color'));
65     $this->assertFalse($this->paragraphsType->hasEnabledBehaviorPlugin('test_dummy_behavior'));
66   }
67
68   /**
69    * Test that invalid plugin id's return false.
70    */
71   public function testInvalidPluginId() {
72     $this->assertFalse($this->paragraphsType->hasEnabledBehaviorPlugin('i_do_not_exist'));
73   }
74
75 }