Completed
Pull Request — 8.x-1.x (#15)
by Vijay
02:38 queued 22s
created
src/Tests/GalleryBundleTest.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
  * @group media
11 11
  */
12 12
 class GalleryBundleTest extends WebTestBase {
13
-  /**
14
-   * Exempt from strict schema checking.
15
-   *
16
-   * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
17
-   *
18
-   * @var bool
19
-   */
20
-  protected $strictConfigSchema = FALSE;
21
-
22
-  /**
23
-   * Modules to enable.
24
-   *
25
-   * @var array
26
-   */
27
-  public static $modules = [
13
+    /**
14
+     * Exempt from strict schema checking.
15
+     *
16
+     * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker
17
+     *
18
+     * @var bool
19
+     */
20
+    protected $strictConfigSchema = FALSE;
21
+
22
+    /**
23
+     * Modules to enable.
24
+     *
25
+     * @var array
26
+     */
27
+    public static $modules = [
28 28
     'media',
29 29
     'media_entity',
30 30
     'media_entity_slideshow',
31 31
     'node',
32 32
     'editor',
33
-  ];
34
-
35
-  /**
36
-   * The test media bundle.
37
-   *
38
-   * @var \Drupal\media_entity\MediaBundleInterface
39
-   */
40
-  protected $testBundle;
41
-
42
-  /**
43
-   * {@inheritdoc}
44
-   */
45
-  protected function setUp() {
33
+    ];
34
+
35
+    /**
36
+     * The test media bundle.
37
+     *
38
+     * @var \Drupal\media_entity\MediaBundleInterface
39
+     */
40
+    protected $testBundle;
41
+
42
+    /**
43
+     * {@inheritdoc}
44
+     */
45
+    protected function setUp() {
46 46
     parent::setUp();
47 47
     $this->testBundle = $this->container->get('entity_type.manager')->getStorage('media_bundle')->load('gallery');
48 48
 
49 49
     $adminUser = $this->drupalCreateUser([
50
-      'view media',
51
-      'create media',
52
-      'update media',
53
-      'update any media',
54
-      'delete media',
55
-      'delete any media',
56
-      'access media overview',
57
-      'access gallery_media_library entity browser pages',
50
+        'view media',
51
+        'create media',
52
+        'update media',
53
+        'update any media',
54
+        'delete media',
55
+        'delete any media',
56
+        'access media overview',
57
+        'access gallery_media_library entity browser pages',
58 58
     ]);
59 59
     $this->drupalLogin($adminUser);
60
-  }
60
+    }
61 61
 
62
-  /**
63
-   * Tests gallery media bundle creation from config files.
64
-   */
65
-  public function testMediaBundleCreationFromModule() {
62
+    /**
63
+     * Tests gallery media bundle creation from config files.
64
+     */
65
+    public function testMediaBundleCreationFromModule() {
66 66
     $type_configuration = [
67
-      'source_field' => 'field_slide',
67
+        'source_field' => 'field_slide',
68 68
     ];
69 69
 
70 70
     $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.');
@@ -73,21 +73,21 @@  discard block
 block discarded – undo
73 73
     $this->assertEqual($this->testBundle->get('type'), 'slideshow', 'Correct plugin ID detected.');
74 74
     $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.');
75 75
     $this->assertEqual($this->testBundle->get('field_map'), [], 'Correct field map detected.');
76
-  }
76
+    }
77 77
 
78
-  /**
79
-   * Tests thumbnail of the gallery item.
80
-   */
81
-  public function testGalleryItemThumbnail() {
78
+    /**
79
+     * Tests thumbnail of the gallery item.
80
+     */
81
+    public function testGalleryItemThumbnail() {
82 82
     // Let's add one image and one video.
83 83
     $imageItem = $this->addImageItem();
84 84
     $videoItem = $this->addVideoItem();
85 85
     $this->drupalGet('media/add/gallery');
86 86
     $pathValue = (string) current($this->xpath('//input[@data-drupal-selector="edit-field-slide-entity-browser-entity-browser-path"]/@value'));
87 87
     $edit = [
88
-      'name[0][value]' => 'Gallery item',
89
-      'field_slide[target_id]' => 'media:' . $imageItem['id'] . ' media:' . $videoItem['id'],
90
-      'field_slide[entity_browser][entity_browser][path]' => $pathValue,
88
+        'name[0][value]' => 'Gallery item',
89
+        'field_slide[target_id]' => 'media:' . $imageItem['id'] . ' media:' . $videoItem['id'],
90
+        'field_slide[entity_browser][entity_browser][path]' => $pathValue,
91 91
     ];
92 92
     $this->drupalPostForm(NULL, $edit, t('Save and publish'));
93 93
 
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 
105 105
     $this->drupalGet('media/add/gallery');
106 106
     $edit = [
107
-      'name[0][value]' => 'Gallery item 2',
108
-      'field_slide[target_id]' => 'media:' . $videoItem['id'] . ' media:' . $imageItem['id'] ,
109
-      'field_slide[entity_browser][entity_browser][path]' => $pathValue,
107
+        'name[0][value]' => 'Gallery item 2',
108
+        'field_slide[target_id]' => 'media:' . $videoItem['id'] . ' media:' . $imageItem['id'] ,
109
+        'field_slide[entity_browser][entity_browser][path]' => $pathValue,
110 110
     ];
111 111
     $this->drupalPostForm(NULL, $edit, t('Save and publish'));
112 112
 
@@ -115,28 +115,28 @@  discard block
 block discarded – undo
115 115
     $gallery = $this->loadMediaItem(reset($gallery_id));
116 116
     $gallery_thumbnail = $gallery->getType()->thumbnail($gallery);
117 117
     $this->assertEqual($gallery_thumbnail, $video_thumbnail, "Correct thumbnail detected.");
118
-  }
118
+    }
119 119
 
120
-  /**
121
-   * Tests that gallery option isn't available in gallery create bundle filters.
122
-   */
123
-  public function testGalleryOption() {
120
+    /**
121
+     * Tests that gallery option isn't available in gallery create bundle filters.
122
+     */
123
+    public function testGalleryOption() {
124 124
     // Open the media library iframe used on add gallery page.
125 125
     $this->drupalGet('entity-browser/modal/gallery_media_library');
126 126
     $this->assertNoOption('edit-bundle-1', 'gallery');
127
-  }
127
+    }
128 128
 
129
-  /**
130
-   * Adds image type item.
131
-   */
132
-  public function addImageItem() {
129
+    /**
130
+     * Adds image type item.
131
+     */
132
+    public function addImageItem() {
133 133
     // Let's add image first.
134 134
     $name = $this->randomMachineName();
135 135
     $testImage = current($this->drupalGetTestFiles('image'));
136 136
     $file_path = $this->container->get('file_system')->realpath($testImage->uri);
137 137
     $edit = [
138
-      'name[0][value]' => $name,
139
-      'files[field_image_0]' => $file_path,
138
+        'name[0][value]' => $name,
139
+        'files[field_image_0]' => $file_path,
140 140
     ];
141 141
     // Save the image.
142 142
     $this->drupalPostForm('media/add/image', $edit, t('Save and publish'));
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
     $edit['id'] = $media_id;
148 148
 
149 149
     return $edit;
150
-  }
150
+    }
151 151
 
152
-  /**
153
-   * Adds video type item.
154
-   */
155
-  public function addVideoItem() {
152
+    /**
153
+     * Adds video type item.
154
+     */
155
+    public function addVideoItem() {
156 156
     $edit = [
157
-      'name[0][value]' => 'Drupal video!',
158
-      'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ',
157
+        'name[0][value]' => 'Drupal video!',
158
+        'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ',
159 159
     ];
160 160
     $this->drupalPostForm('media/add/video', $edit, t('Save and publish'));
161 161
     // Obtain the video id.
@@ -164,22 +164,22 @@  discard block
 block discarded – undo
164 164
     $edit['id'] = $media_id;
165 165
 
166 166
     return $edit;
167
-  }
168
-
169
-  /**
170
-   * Loads the media entity item.
171
-   *
172
-   * @param int $id
173
-   *   The id of the item.
174
-   *
175
-   * @return \Drupal\media_entity\MediaInterface
176
-   *   The media entity item.
177
-   */
178
-  public function loadMediaItem($id) {
167
+    }
168
+
169
+    /**
170
+     * Loads the media entity item.
171
+     *
172
+     * @param int $id
173
+     *   The id of the item.
174
+     *
175
+     * @return \Drupal\media_entity\MediaInterface
176
+     *   The media entity item.
177
+     */
178
+    public function loadMediaItem($id) {
179 179
     $item = $this->container->get('entity_type.manager')
180
-      ->getStorage('media')
181
-      ->loadUnchanged($id);
180
+        ->getStorage('media')
181
+        ->loadUnchanged($id);
182 182
     return $item;
183
-  }
183
+    }
184 184
 
185 185
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
     $this->drupalGet('media/add/gallery');
106 106
     $edit = [
107 107
       'name[0][value]' => 'Gallery item 2',
108
-      'field_slide[target_id]' => 'media:' . $videoItem['id'] . ' media:' . $imageItem['id'] ,
108
+      'field_slide[target_id]' => 'media:' . $videoItem['id'] . ' media:' . $imageItem['id'],
109 109
       'field_slide[entity_browser][entity_browser][path]' => $pathValue,
110 110
     ];
111 111
     $this->drupalPostForm(NULL, $edit, t('Save and publish'));
Please login to merge, or discard this patch.
tests/src/FunctionalJavascript/EmbedButtonTest.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -11,45 +11,45 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class EmbedButtonTest extends JavascriptTestBase {
13 13
 
14
-  /**
15
-   * {@inheritdoc}
16
-   */
17
-  public static $modules = [
14
+    /**
15
+     * {@inheritdoc}
16
+     */
17
+    public static $modules = [
18 18
     'node',
19 19
     'path',
20 20
     'text',
21
-  ];
21
+    ];
22 22
 
23
-  /**
24
-   * {@inheritdoc}
25
-   */
26
-  public function setUp() {
23
+    /**
24
+     * {@inheritdoc}
25
+     */
26
+    public function setUp() {
27 27
     parent::setUp();
28 28
     // Manually installing modules to preserve the order.
29 29
     $this->installModule('media_embed_test');
30 30
     $this->installModule('media');
31 31
     $adminUser = $this->drupalCreateUser([
32
-      'access content',
33
-      'use text format basic_html',
34
-      'use text format full_html',
35
-      'access media_embed entity browser pages',
36
-      'view media',
37
-      'create media',
38
-      'update media',
39
-      'update any media',
40
-      'delete media',
41
-      'delete any media',
42
-      'access media overview',
43
-      'create page content',
44
-      'edit any page content',
32
+        'access content',
33
+        'use text format basic_html',
34
+        'use text format full_html',
35
+        'access media_embed entity browser pages',
36
+        'view media',
37
+        'create media',
38
+        'update media',
39
+        'update any media',
40
+        'delete media',
41
+        'delete any media',
42
+        'access media overview',
43
+        'create page content',
44
+        'edit any page content',
45 45
     ]);
46 46
     $this->drupalLogin($adminUser);
47
-  }
47
+    }
48 48
 
49
-  /**
50
-   * Tests that the entity embed dialog is working.
51
-   */
52
-  public function testMediaEmbedDialog() {
49
+    /**
50
+     * Tests that the entity embed dialog is working.
51
+     */
52
+    public function testMediaEmbedDialog() {
53 53
     // Find the button and click it to see if the modal opens.
54 54
     $this->drupalGet('node/add/page');
55 55
     $this->find('.cke_button__media')->click();
@@ -71,38 +71,38 @@  discard block
 block discarded – undo
71 71
     $this->assertEquals(200, $this->getSession()->getStatusCode());
72 72
     $filter = $this->getSession()->getPage()->find('css', 'input[name="name"]');
73 73
     $this->assertTrue($filter, "Found filter");
74
-  }
74
+    }
75 75
 
76
-  /**
77
-   * Installs the module using module_handler service.
78
-   *
79
-   * @param string $module_name
80
-   *   Name of the module to install.
81
-   */
82
-  public function installModule($module_name) {
76
+    /**
77
+     * Installs the module using module_handler service.
78
+     *
79
+     * @param string $module_name
80
+     *   Name of the module to install.
81
+     */
82
+    public function installModule($module_name) {
83 83
     if (!$this->container->get('module_handler')->moduleExists($module_name)) {
84
-      $this->container->get('module_installer')->install(array($module_name));
84
+        $this->container->get('module_installer')->install(array($module_name));
85
+    }
85 86
     }
86
-  }
87 87
 
88
-  /**
89
-   * Wait for AJAX.
90
-   */
91
-  protected function wait() {
88
+    /**
89
+     * Wait for AJAX.
90
+     */
91
+    protected function wait() {
92 92
     $this->getSession()->wait(20000, '(0 === jQuery.active)');
93
-  }
93
+    }
94 94
 
95
-  /**
96
-   * Find an element based on a CSS selector.
97
-   *
98
-   * @param string $css_selector
99
-   *   A css selector to find an element for.
100
-   *
101
-   * @return \Behat\Mink\Element\NodeElement|null
102
-   *   The found element or null.
103
-   */
104
-  protected function find($css_selector) {
95
+    /**
96
+     * Find an element based on a CSS selector.
97
+     *
98
+     * @param string $css_selector
99
+     *   A css selector to find an element for.
100
+     *
101
+     * @return \Behat\Mink\Element\NodeElement|null
102
+     *   The found element or null.
103
+     */
104
+    protected function find($css_selector) {
105 105
     return $this->getSession()->getPage()->find('css', $css_selector);
106
-  }
106
+    }
107 107
 
108 108
 }
Please login to merge, or discard this patch.