@@ -10,65 +10,65 @@ discard block |
||
10 | 10 | * @group media |
11 | 11 | */ |
12 | 12 | class InstagramBundleTest 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; |
|
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 | 21 | |
22 | - /** |
|
23 | - * Modules to enable. |
|
24 | - * |
|
25 | - * @var array |
|
26 | - */ |
|
27 | - public static $modules = [ |
|
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_instagram', |
31 | 31 | 'link', |
32 | 32 | 'node', |
33 | - ]; |
|
33 | + ]; |
|
34 | 34 | |
35 | - /** |
|
36 | - * The test media bundle. |
|
37 | - * |
|
38 | - * @var \Drupal\media_entity\MediaBundleInterface |
|
39 | - */ |
|
40 | - protected $testBundle; |
|
35 | + /** |
|
36 | + * The test media bundle. |
|
37 | + * |
|
38 | + * @var \Drupal\media_entity\MediaBundleInterface |
|
39 | + */ |
|
40 | + protected $testBundle; |
|
41 | 41 | |
42 | - /** |
|
43 | - * {@inheritdoc} |
|
44 | - */ |
|
45 | - protected function setUp() { |
|
42 | + /** |
|
43 | + * {@inheritdoc} |
|
44 | + */ |
|
45 | + protected function setUp() { |
|
46 | 46 | parent::setUp(); |
47 | 47 | $this->testBundle = $this->container->get('entity.manager')->getStorage('media_bundle')->load('instagram'); |
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', |
|
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 | 57 | ]); |
58 | 58 | $this->drupalLogin($adminUser); |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Tests instagram media bundle creation from config files. |
|
63 | - */ |
|
64 | - public function testMediaBundleCreationFromModule() { |
|
61 | + /** |
|
62 | + * Tests instagram media bundle creation from config files. |
|
63 | + */ |
|
64 | + public function testMediaBundleCreationFromModule() { |
|
65 | 65 | $type_configuration = [ |
66 | - 'use_instagram_api' => FALSE, |
|
67 | - 'source_field' => 'field_instagram_url', |
|
68 | - 'client_id' => '', |
|
66 | + 'use_instagram_api' => FALSE, |
|
67 | + 'source_field' => 'field_instagram_url', |
|
68 | + 'client_id' => '', |
|
69 | 69 | ]; |
70 | 70 | $field_map = [ |
71 | - 'shortcode' => 'field_instagram_shortcode', |
|
71 | + 'shortcode' => 'field_instagram_shortcode', |
|
72 | 72 | ]; |
73 | 73 | |
74 | 74 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | $this->assertEqual($this->testBundle->get('type'), 'instagram', 'Correct plugin ID detected.'); |
78 | 78 | $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.'); |
79 | 79 | $this->assertEqual($this->testBundle->get('field_map'), $field_map, 'Correct field map detected.'); |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Tests item creation and thumbnail. |
|
84 | - */ |
|
85 | - public function testMediaBundleItemCreation() { |
|
82 | + /** |
|
83 | + * Tests item creation and thumbnail. |
|
84 | + */ |
|
85 | + public function testMediaBundleItemCreation() { |
|
86 | 86 | // Define the media item name. |
87 | 87 | $name = $this->randomMachineName(); |
88 | 88 | $instagram_url = 'https://www.instagram.com/p/C/'; |
89 | 89 | $edit = [ |
90 | - 'name[0][value]' => $name, |
|
91 | - 'field_instagram_url[0][uri]' => $instagram_url, |
|
90 | + 'name[0][value]' => $name, |
|
91 | + 'field_instagram_url[0][uri]' => $instagram_url, |
|
92 | 92 | ]; |
93 | 93 | |
94 | 94 | // Save the Instagram post. |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | $media_id = reset($media_id); |
103 | 103 | /** @var \Drupal\media_entity\MediaInterface $media */ |
104 | 104 | $media = $this->container->get('entity_type.manager') |
105 | - ->getStorage('media') |
|
106 | - ->loadUnchanged($media_id); |
|
105 | + ->getStorage('media') |
|
106 | + ->loadUnchanged($media_id); |
|
107 | 107 | $properties = $media->toArray(); |
108 | 108 | $this->assertEqual($media->get('field_instagram_shortcode')[0]->getValue()['value'], "C", "Correct shortcode stored."); |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | 111 | } |