1 | <?php |
||
13 | abstract class EmbedTestBase extends WebTestBase { |
||
14 | |||
15 | /** |
||
16 | * Modules to enable. |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | public static $modules = [ |
||
21 | 'block', |
||
22 | 'embed', |
||
23 | 'embed_test', |
||
24 | 'editor', |
||
25 | 'ckeditor', |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * The test administrative user. |
||
30 | * |
||
31 | * @var \Drupal\user\UserInterface |
||
32 | */ |
||
33 | protected $adminUser; |
||
34 | |||
35 | /** |
||
36 | * The test administrative user. |
||
37 | * |
||
38 | * @var \Drupal\user\UserInterface |
||
39 | */ |
||
40 | protected $webUser; |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | protected function setUp() { |
||
46 | parent::setUp(); |
||
47 | |||
48 | // Create Filtered HTML text format and enable entity_embed filter. |
||
49 | $format = FilterFormat::create([ |
||
50 | 'format' => 'embed_test', |
||
51 | 'name' => 'Embed format', |
||
52 | 'filters' => [], |
||
53 | ]); |
||
54 | $format->save(); |
||
55 | |||
56 | $editor_group = [ |
||
57 | 'name' => 'Embed', |
||
58 | 'items' => [ |
||
59 | 'embed_test_default', |
||
60 | ], |
||
61 | ]; |
||
62 | $editor = Editor::create([ |
||
63 | 'format' => 'embed_test', |
||
64 | 'editor' => 'ckeditor', |
||
65 | 'settings' => [ |
||
66 | 'toolbar' => [ |
||
67 | 'rows' => [[$editor_group]], |
||
68 | ], |
||
69 | ], |
||
70 | ]); |
||
71 | $editor->save(); |
||
72 | |||
73 | // Create a user with required permissions. |
||
74 | $this->adminUser = $this->drupalCreateUser([ |
||
75 | 'administer embed buttons', |
||
76 | 'use text format embed_test', |
||
77 | ]); |
||
78 | |||
79 | // Create a user with required permissions. |
||
80 | $this->webUser = $this->drupalCreateUser([ |
||
81 | 'use text format embed_test', |
||
82 | ]); |
||
83 | |||
84 | // Set up some standard blocks for the testing theme (Classy). |
||
85 | // @see https://www.drupal.org/node/507488?page=1#comment-10291517 |
||
86 | $this->drupalPlaceBlock('local_tasks_block'); |
||
87 | $this->drupalPlaceBlock('local_actions_block'); |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * Retrieves a sample file of the specified type. |
||
92 | * |
||
93 | * @return \Drupal\file\FileInterface |
||
94 | */ |
||
95 | protected function getTestFile($type_name, $size = NULL) { |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | * |
||
111 | * This is a duplicate of WebTestBase::drupalProcessAjaxResponse() that |
||
112 | * includes the fix from https://www.drupal.org/node/2554449 for using ID |
||
113 | * selectors in AJAX commands. |
||
114 | */ |
||
115 | protected function drupalProcessAjaxResponse($content, array $ajax_response, array $ajax_settings, array $drupal_settings) { |
||
223 | |||
224 | } |
||
225 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.