Completed
Push — 8.x-1.x ( ed2f7b...a381b9 )
by Janez
7s
created
src/Tests/ImageBundleTest.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -11,52 +11,52 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class ImageBundleTest extends WebTestBase {
13 13
 
14
-  /**
15
-   * Modules to enable.
16
-   *
17
-   * @var array
18
-   */
19
-  public static $modules = [
14
+    /**
15
+     * Modules to enable.
16
+     *
17
+     * @var array
18
+     */
19
+    public static $modules = [
20 20
     'media',
21 21
     'media_entity',
22 22
     'media_entity_image',
23 23
     'image',
24 24
     'node',
25
-  ];
25
+    ];
26 26
 
27
-  /**
28
-   * The test media bundle.
29
-   *
30
-   * @var \Drupal\media_entity\MediaBundleInterface
31
-   */
32
-  protected $testBundle;
27
+    /**
28
+     * The test media bundle.
29
+     *
30
+     * @var \Drupal\media_entity\MediaBundleInterface
31
+     */
32
+    protected $testBundle;
33 33
 
34
-  /**
35
-   * {@inheritdoc}
36
-   */
37
-  protected function setUp() {
34
+    /**
35
+     * {@inheritdoc}
36
+     */
37
+    protected function setUp() {
38 38
     parent::setUp();
39 39
     $this->testBundle = $this->container->get('entity.manager')->getStorage('media_bundle')->load('image');
40 40
 
41 41
     $adminUser = $this->drupalCreateUser([
42
-      'view media',
43
-      'create media',
44
-      'update media',
45
-      'update any media',
46
-      'delete media',
47
-      'delete any media',
48
-      'access media overview',
42
+        'view media',
43
+        'create media',
44
+        'update media',
45
+        'update any media',
46
+        'delete media',
47
+        'delete any media',
48
+        'access media overview',
49 49
     ]);
50 50
     $this->drupalLogin($adminUser);
51
-  }
51
+    }
52 52
 
53
-  /**
54
-   * Tests image media bundle creation from config files.
55
-   */
56
-  public function testMediaBundleCreationFromModule() {
53
+    /**
54
+     * Tests image media bundle creation from config files.
55
+     */
56
+    public function testMediaBundleCreationFromModule() {
57 57
     $type_configuration = [
58
-      'source_field' => 'field_image',
59
-      'gather_exif' => FALSE,
58
+        'source_field' => 'field_image',
59
+        'gather_exif' => FALSE,
60 60
     ];
61 61
 
62 62
     $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.');
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
     $this->assertEqual($this->testBundle->get('type'), 'image', 'Correct plugin ID detected.');
66 66
     $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.');
67 67
     $this->assertEqual($this->testBundle->get('field_map'), [], 'Correct field map detected.');
68
-  }
68
+    }
69 69
 
70
-  /**
71
-   * Tests item creation and thumbnail.
72
-   */
73
-  public function testMediaBundleItemCreation() {
70
+    /**
71
+     * Tests item creation and thumbnail.
72
+     */
73
+    public function testMediaBundleItemCreation() {
74 74
     // Define the media item name.
75 75
     $name = $this->randomMachineName();
76 76
     $image_files = $this->drupalGetTestFiles('image');
77 77
     $testImage = current($image_files);
78 78
     $file_path = $this->container->get('file_system')->realpath($testImage->uri);
79 79
     $edit = [
80
-      'name[0][value]' => $name,
81
-      'files[field_image_0]' => $file_path,
80
+        'name[0][value]' => $name,
81
+        'files[field_image_0]' => $file_path,
82 82
     ];
83 83
 
84 84
     // Save the image.
@@ -97,6 +97,6 @@  discard block
 block discarded – undo
97 97
     $thumbnail = $image->thumbnail($media);
98 98
     $default_thumbnail = $image->getDefaultThumbnail();
99 99
     $this->assertNotEqual($thumbnail, $default_thumbnail, "The thumbnail generated is different from the default thumbnail.");
100
-  }
100
+    }
101 101
 
102 102
 }
Please login to merge, or discard this patch.
media.module 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
  * Implements hook_help().
12 12
  */
13 13
 function media_help($route_name, RouteMatchInterface $route_match) {
14
-  switch ($route_name) {
14
+    switch ($route_name) {
15 15
     // Main module help for the media module.
16 16
     case 'help.page.media':
17 17
       $output = '';
18
-      $output .= '<h3>' . t('About') . '</h3>';
19
-      $output .= '<p>' . t('Media module for Drupal 8') . '</p>';
20
-      return $output;
18
+        $output .= '<h3>' . t('About') . '</h3>';
19
+        $output .= '<p>' . t('Media module for Drupal 8') . '</p>';
20
+        return $output;
21 21
 
22 22
     default:
23 23
   }
Please login to merge, or discard this patch.
src/Tests/VideoBundleTest.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -11,56 +11,56 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class VideoBundleTest extends WebTestBase {
13 13
 
14
-  /**
15
-   * Modules to enable.
16
-   *
17
-   * @var array
18
-   */
19
-  public static $modules = [
14
+    /**
15
+     * Modules to enable.
16
+     *
17
+     * @var array
18
+     */
19
+    public static $modules = [
20 20
     'media',
21 21
     'media_entity',
22 22
     'video_embed_field',
23 23
     'video_embed_media',
24 24
     'node',
25
-  ];
25
+    ];
26 26
 
27
-  /**
28
-   * The test media bundle.
29
-   *
30
-   * @var \Drupal\media_entity\MediaBundleInterface
31
-   */
32
-  protected $testBundle;
27
+    /**
28
+     * The test media bundle.
29
+     *
30
+     * @var \Drupal\media_entity\MediaBundleInterface
31
+     */
32
+    protected $testBundle;
33 33
 
34
-  /**
35
-   * {@inheritdoc}
36
-   */
37
-  protected function setUp() {
34
+    /**
35
+     * {@inheritdoc}
36
+     */
37
+    protected function setUp() {
38 38
     parent::setUp();
39 39
     $this->testBundle = $this->container->get('entity.manager')->getStorage('media_bundle')->load('video');
40 40
 
41 41
     $adminUser = $this->drupalCreateUser([
42
-      'view media',
43
-      'create media',
44
-      'update media',
45
-      'update any media',
46
-      'delete media',
47
-      'delete any media',
48
-      'access media overview',
42
+        'view media',
43
+        'create media',
44
+        'update media',
45
+        'update any media',
46
+        'delete media',
47
+        'delete any media',
48
+        'access media overview',
49 49
     ]);
50 50
     $this->drupalLogin($adminUser);
51
-  }
51
+    }
52 52
 
53
-  /**
54
-   * Tests video media bundle creation from config files.
55
-   */
56
-  public function testMediaBundleCreationFromModule() {
53
+    /**
54
+     * Tests video media bundle creation from config files.
55
+     */
56
+    public function testMediaBundleCreationFromModule() {
57 57
     $type_configuration = [
58
-      'source_field' => 'field_video',
58
+        'source_field' => 'field_video',
59 59
     ];
60 60
 
61 61
     $field_map = [
62
-      'id' => 'field_id',
63
-      'source_name' => 'field_source',
62
+        'id' => 'field_id',
63
+        'source_name' => 'field_source',
64 64
     ];
65 65
 
66 66
     $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.');
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
     $this->assertEqual($this->testBundle->get('type'), 'video_embed_field', 'Correct plugin ID detected.');
70 70
     $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.');
71 71
     $this->assertEqual($this->testBundle->get('field_map'), $field_map, 'Correct field map detected.');
72
-  }
72
+    }
73 73
 
74
-  /**
75
-   * Tests video media bundle field maps.
76
-   */
77
-  public function testBundleFieldMap() {
74
+    /**
75
+     * Tests video media bundle field maps.
76
+     */
77
+    public function testBundleFieldMap() {
78 78
     $edit = [
79
-      'name[0][value]' => 'Drupal video!',
80
-      'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ',
79
+        'name[0][value]' => 'Drupal video!',
80
+        'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ',
81 81
     ];
82 82
     $this->drupalPostForm('media/add/' . $this->testBundle->id(), $edit, t('Save and publish'));
83 83
 
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
     $media_id = reset($media_id);
87 87
     /** @var \Drupal\media_entity\MediaInterface $media */
88 88
     $media = $this->container->get('entity_type.manager')
89
-      ->getStorage('media')
90
-      ->loadUnchanged($media_id);
89
+        ->getStorage('media')
90
+        ->loadUnchanged($media_id);
91 91
     $properties = $media->toArray();
92 92
     $this->assertEqual($properties['field_id'][0]['value'], 'XgYu7-DQjDQ', 'Correct video ID detected.');
93 93
     $this->assertEqual($properties['field_source'][0]['value'], 'youtube', 'Correct video source detected.');
94
-  }
94
+    }
95 95
 
96 96
 }
Please login to merge, or discard this patch.