1 | <?php |
||
15 | class EmbedButtonAdminTest extends EmbedTestBase { |
||
16 | |||
17 | /** |
||
18 | * Tests the embed_button administration functionality. |
||
19 | */ |
||
20 | public function testEmbedButtonAdmin() { |
||
21 | // Ensure proper access to the Embed settings page. |
||
22 | $this->drupalGet('admin/config/content/embed'); |
||
23 | $this->assertResponse(403); |
||
24 | |||
25 | $this->drupalLogin($this->adminUser); |
||
26 | $this->drupalGet('admin/config/content/embed'); |
||
27 | $this->assertResponse(200); |
||
28 | |||
29 | // Add embed button. |
||
30 | $this->clickLink('Add embed button'); |
||
31 | $button_id = strtolower($this->randomMachineName()); |
||
32 | $button_label = $this->randomMachineName(); |
||
33 | $edit = array( |
||
34 | 'id' => $button_id, |
||
35 | 'label' => $button_label, |
||
36 | 'type_id' => 'embed_test_default', |
||
37 | ); |
||
38 | $this->drupalPostForm(NULL, $edit, 'Save'); |
||
39 | // Ensure that the newly created button is listed. |
||
40 | $this->drupalGet('admin/config/content/embed'); |
||
41 | $this->assertText($button_label, 'Test embed_button appears on the list page'); |
||
42 | |||
43 | // Edit embed button. |
||
44 | $this->drupalGet('admin/config/content/embed/button/manage/' . $button_id); |
||
45 | $new_button_label = $this->randomMachineName(); |
||
46 | $edit = array( |
||
47 | 'label' => $new_button_label, |
||
48 | ); |
||
49 | $this->drupalPostForm(NULL, $edit, 'Save'); |
||
50 | // Ensure that name and label has been changed. |
||
51 | $this->drupalGet('admin/config/content/embed'); |
||
52 | $this->assertText($new_button_label, 'New label appears on the list page'); |
||
53 | $this->assertNoText($button_label, 'Old label does not appears on the list page'); |
||
54 | |||
55 | // Delete embed button. |
||
56 | $this->drupalGet('admin/config/content/embed/button/manage/' . $button_id . '/delete'); |
||
57 | $this->drupalPostForm(NULL, array(), 'Delete'); |
||
58 | // Ensure that the deleted embed button no longer exists. |
||
59 | $this->drupalGet('admin/config/content/embed/button/manage/' . $button_id); |
||
60 | $this->assertResponse(404, 'Deleted embed button no longer exists.'); |
||
61 | // Ensure that the deleted button is no longer listed. |
||
62 | $this->drupalGet('admin/config/content/embed'); |
||
63 | $this->assertNoText($button_label, 'Test embed_button does not appears on the list page'); |
||
64 | } |
||
65 | |||
66 | public function testButtonValidation() { |
||
88 | |||
89 | public function testCKEditorButtonConflict() { |
||
102 | |||
103 | } |
||
104 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.