@@ -18,37 +18,37 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class ImageBundleTest extends WebTestBase { |
20 | 20 | |
21 | - /** |
|
22 | - * Modules to enable. |
|
23 | - * |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - public static $modules = ['media', 'media_entity', 'media_entity_image', 'image', 'node']; |
|
21 | + /** |
|
22 | + * Modules to enable. |
|
23 | + * |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + public static $modules = ['media', 'media_entity', 'media_entity_image', 'image', 'node']; |
|
27 | 27 | |
28 | - /** |
|
29 | - * The test media bundle. |
|
30 | - * |
|
31 | - * @var \Drupal\media_entity\MediaBundleInterface |
|
32 | - */ |
|
33 | - protected $testBundle; |
|
34 | - /** |
|
35 | - * Contains the media bundle storage |
|
36 | - * |
|
37 | - * @var \Drupal\media_entity\MediaBundleInterface |
|
38 | - */ |
|
39 | - protected $bundleStorage; |
|
28 | + /** |
|
29 | + * The test media bundle. |
|
30 | + * |
|
31 | + * @var \Drupal\media_entity\MediaBundleInterface |
|
32 | + */ |
|
33 | + protected $testBundle; |
|
34 | + /** |
|
35 | + * Contains the media bundle storage |
|
36 | + * |
|
37 | + * @var \Drupal\media_entity\MediaBundleInterface |
|
38 | + */ |
|
39 | + protected $bundleStorage; |
|
40 | 40 | |
41 | - /** |
|
42 | - * The test user. |
|
43 | - * |
|
44 | - * @var \Drupal\User\UserInterface |
|
45 | - */ |
|
46 | - protected $adminUser; |
|
41 | + /** |
|
42 | + * The test user. |
|
43 | + * |
|
44 | + * @var \Drupal\User\UserInterface |
|
45 | + */ |
|
46 | + protected $adminUser; |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritdoc} |
|
50 | - */ |
|
51 | - protected function setUp() { |
|
48 | + /** |
|
49 | + * {@inheritdoc} |
|
50 | + */ |
|
51 | + protected function setUp() { |
|
52 | 52 | parent::setUp(); |
53 | 53 | $entityManager = $this->container->get('entity.manager'); |
54 | 54 | $this->bundleStorage = $entityManager->getStorage('media_bundle'); |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | 'access media overview', |
65 | 65 | ]); |
66 | 66 | $this->drupalLogin($this->adminUser); |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Tests image media bundle creation from config files. |
|
71 | - */ |
|
72 | - public function testMediaBundleCreationFromModule() { |
|
69 | + /** |
|
70 | + * Tests image media bundle creation from config files. |
|
71 | + */ |
|
72 | + public function testMediaBundleCreationFromModule() { |
|
73 | 73 | $type_configuration = array( |
74 | - 'source_field' => 'field_image', |
|
75 | - 'gather_exif' => false |
|
74 | + 'source_field' => 'field_image', |
|
75 | + 'gather_exif' => false |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | $this->assertEqual($this->testBundle->get('type'), 'image', 'Correct plugin ID detected.'); |
82 | 82 | $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.'); |
83 | 83 | $this->assertEqual($this->testBundle->get('field_map'), [], 'Correct field map detected.'); |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Tests item creation and thumbnail |
|
88 | - */ |
|
89 | - public function testMediaBundleItemCreation(){ |
|
86 | + /** |
|
87 | + * Tests item creation and thumbnail |
|
88 | + */ |
|
89 | + public function testMediaBundleItemCreation(){ |
|
90 | 90 | // Define the media item name. |
91 | 91 | $name = $this->randomMachineName(); |
92 | 92 | $image_files = $this->drupalGetTestFiles('image'); |
93 | 93 | $testImage = File::create((array) current($image_files)); |
94 | 94 | $file_path = $this->container->get('file_system')->realpath($testImage->getFileUri()); |
95 | 95 | $edit = [ |
96 | - 'name[0][value]' => $name, |
|
97 | - 'files[field_image_0]' => $file_path, |
|
96 | + 'name[0][value]' => $name, |
|
97 | + 'files[field_image_0]' => $file_path, |
|
98 | 98 | ]; |
99 | 99 | |
100 | 100 | // Save the image |
@@ -132,5 +132,5 @@ discard block |
||
132 | 132 | ) |
133 | 133 | ); |
134 | 134 | $this->assertEqual(count($elements), 1, 'Thumbnail found on the page.'); |
135 | - } |
|
135 | + } |
|
136 | 136 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * Tests item creation and thumbnail |
88 | 88 | */ |
89 | - public function testMediaBundleItemCreation(){ |
|
89 | + public function testMediaBundleItemCreation() { |
|
90 | 90 | // Define the media item name. |
91 | 91 | $name = $this->randomMachineName(); |
92 | 92 | $image_files = $this->drupalGetTestFiles('image'); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $itok = $query['itok']; |
123 | 123 | $thumbnail_uri = ImageStyle::load('thumbnail')->buildUri($image_uri); |
124 | 124 | $src = file_url_transform_relative(file_create_url($thumbnail_uri)); |
125 | - $src = $src.'?itok='.$itok; |
|
125 | + $src = $src . '?itok=' . $itok; |
|
126 | 126 | $elements = $this->xpath( |
127 | 127 | '//img[@src=:url and @alt=:alt and @title=:title]', |
128 | 128 | array( |