Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / paragraphs / src / Tests / Experimental / ParagraphsExperimentalTypesTest.php
1 <?php
2
3 namespace Drupal\paragraphs\Tests\Experimental;
4
5 /**
6  * Tests paragraphs types.
7  *
8  * @group paragraphs
9  */
10 class ParagraphsExperimentalTypesTest extends ParagraphsExperimentalTestBase {
11
12   /**
13    * Tests the deletion of Paragraphs types.
14    */
15   public function testRemoveTypesWithContent() {
16     $this->loginAsAdmin();
17     // Add a Paragraphed test content.
18     $this->addParagraphedContentType('paragraphed_test', 'paragraphs');
19
20     $this->addParagraphsType('paragraph_type_test');
21     $this->addParagraphsType('text');
22
23     // Attempt to delete the content type not used yet.
24     $this->drupalGet('admin/structure/paragraphs_type');
25     $this->clickLink(t('Delete'));
26     $this->assertText('This action cannot be undone.');
27     $this->clickLink(t('Cancel'));
28
29     // Add a test node with a Paragraph.
30     $this->drupalGet('node/add/paragraphed_test');
31     $this->drupalPostAjaxForm(NULL, [], 'paragraphs_paragraph_type_test_add_more');
32     $edit = ['title[0][value]' => 'test_node'];
33     $this->drupalPostForm(NULL, $edit, t('Save'));
34     $this->assertText('paragraphed_test test_node has been created.');
35
36     // Attempt to delete the paragraph type already used.
37     $this->drupalGet('admin/structure/paragraphs_type');
38     $this->clickLink(t('Delete'));
39     $this->assertText('paragraph_type_test Paragraphs type is used by 1 piece of content on your site. You can not remove this paragraph_type_test Paragraphs type until you have removed all from the content.');
40   }
41
42   /**
43    * Tests creating paragraph type.
44    */
45   public function testCreateParagraphType() {
46     $this->loginAsAdmin();
47
48     // Add a paragraph type.
49     $this->drupalGet('/admin/structure/paragraphs_type/add');
50
51     // Create a paragraph type with label and id more than 32 characters.
52     $edit = [
53       'label' => 'Test',
54       'id' => 'test_name_with_more_than_32_characters'
55     ];
56     $this->drupalPostForm(NULL, $edit, 'Save and manage fields');
57     $this->assertNoErrorsLogged();
58     $this->assertText('Machine-readable name cannot be longer than 32 characters but is currently 38 characters long.');
59     $edit['id'] = 'new_test_id';
60     $this->drupalPostForm(NULL, $edit, 'Save and manage fields');
61     $this->assertText('Saved the Test Paragraphs type.');
62   }
63 }