@@ -11,24 +11,24 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | class ImageBundleTest extends WebTestBase { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Modules to enable. |
|
| 16 | - * |
|
| 17 | - * @var array |
|
| 18 | - */ |
|
| 19 | - public static $modules = ['media', 'media_entity', 'media_entity_image', 'image', 'node']; |
|
| 14 | + /** |
|
| 15 | + * Modules to enable. |
|
| 16 | + * |
|
| 17 | + * @var array |
|
| 18 | + */ |
|
| 19 | + public static $modules = ['media', 'media_entity', 'media_entity_image', 'image', 'node']; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * The test media bundle. |
|
| 23 | - * |
|
| 24 | - * @var \Drupal\media_entity\MediaBundleInterface |
|
| 25 | - */ |
|
| 26 | - protected $testBundle; |
|
| 21 | + /** |
|
| 22 | + * The test media bundle. |
|
| 23 | + * |
|
| 24 | + * @var \Drupal\media_entity\MediaBundleInterface |
|
| 25 | + */ |
|
| 26 | + protected $testBundle; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * {@inheritdoc} |
|
| 30 | - */ |
|
| 31 | - protected function setUp() { |
|
| 28 | + /** |
|
| 29 | + * {@inheritdoc} |
|
| 30 | + */ |
|
| 31 | + protected function setUp() { |
|
| 32 | 32 | parent::setUp(); |
| 33 | 33 | $this->testBundle = $this->container->get('entity.manager')->getStorage('media_bundle')->load('image'); |
| 34 | 34 | |
@@ -42,15 +42,15 @@ discard block |
||
| 42 | 42 | 'access media overview', |
| 43 | 43 | ]); |
| 44 | 44 | $this->drupalLogin($adminUser); |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Tests image media bundle creation from config files. |
|
| 49 | - */ |
|
| 50 | - public function testMediaBundleCreationFromModule() { |
|
| 47 | + /** |
|
| 48 | + * Tests image media bundle creation from config files. |
|
| 49 | + */ |
|
| 50 | + public function testMediaBundleCreationFromModule() { |
|
| 51 | 51 | $type_configuration = [ |
| 52 | - 'source_field' => 'field_image', |
|
| 53 | - 'gather_exif' => false |
|
| 52 | + 'source_field' => 'field_image', |
|
| 53 | + 'gather_exif' => false |
|
| 54 | 54 | ]; |
| 55 | 55 | |
| 56 | 56 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); |
@@ -59,20 +59,20 @@ discard block |
||
| 59 | 59 | $this->assertEqual($this->testBundle->get('type'), 'image', 'Correct plugin ID detected.'); |
| 60 | 60 | $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.'); |
| 61 | 61 | $this->assertEqual($this->testBundle->get('field_map'), [], 'Correct field map detected.'); |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Tests item creation and thumbnail |
|
| 66 | - */ |
|
| 67 | - public function testMediaBundleItemCreation() { |
|
| 64 | + /** |
|
| 65 | + * Tests item creation and thumbnail |
|
| 66 | + */ |
|
| 67 | + public function testMediaBundleItemCreation() { |
|
| 68 | 68 | // Define the media item name. |
| 69 | 69 | $name = $this->randomMachineName(); |
| 70 | 70 | $image_files = $this->drupalGetTestFiles('image'); |
| 71 | 71 | $testImage = current($image_files); |
| 72 | 72 | $file_path = $this->container->get('file_system')->realpath($testImage->uri); |
| 73 | 73 | $edit = [ |
| 74 | - 'name[0][value]' => $name, |
|
| 75 | - 'files[field_image_0]' => $file_path, |
|
| 74 | + 'name[0][value]' => $name, |
|
| 75 | + 'files[field_image_0]' => $file_path, |
|
| 76 | 76 | ]; |
| 77 | 77 | |
| 78 | 78 | // Save the image |
@@ -92,5 +92,5 @@ discard block |
||
| 92 | 92 | $thumbnail = $image->thumbnail($media); |
| 93 | 93 | $default_thumbnail = $image->getDefaultThumbnail(); |
| 94 | 94 | $this->assertNotEqual($thumbnail, $default_thumbnail, "The thumbnail generated is different from the default thumbnail."); |
| 95 | - } |
|
| 95 | + } |
|
| 96 | 96 | } |