@@ -10,69 +10,69 @@ discard block |
||
10 | 10 | * @group media |
11 | 11 | */ |
12 | 12 | class TweetBundleTest 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_twitter', |
31 | 31 | 'node', |
32 | 32 | 'link', |
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('tweet'); |
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 tweet media bundle creation from config files. |
|
63 | - */ |
|
64 | - public function testMediaBundleCreationFromModule() { |
|
61 | + /** |
|
62 | + * Tests tweet media bundle creation from config files. |
|
63 | + */ |
|
64 | + public function testMediaBundleCreationFromModule() { |
|
65 | 65 | $type_configuration = [ |
66 | - 'use_twitter_api' => FALSE, |
|
67 | - 'source_field' => 'field_tweet_url', |
|
68 | - 'consumer_key' => '', |
|
69 | - 'consumer_secret' => '', |
|
70 | - 'oauth_access_token' => '', |
|
71 | - 'oauth_access_token_secret' => '', |
|
66 | + 'use_twitter_api' => FALSE, |
|
67 | + 'source_field' => 'field_tweet_url', |
|
68 | + 'consumer_key' => '', |
|
69 | + 'consumer_secret' => '', |
|
70 | + 'oauth_access_token' => '', |
|
71 | + 'oauth_access_token_secret' => '', |
|
72 | 72 | ]; |
73 | 73 | $field_map = [ |
74 | - 'id' => 'field_tweet_id', |
|
75 | - 'user' => 'field_tweet_author', |
|
74 | + 'id' => 'field_tweet_id', |
|
75 | + 'user' => 'field_tweet_author', |
|
76 | 76 | ]; |
77 | 77 | |
78 | 78 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); |
@@ -81,18 +81,18 @@ discard block |
||
81 | 81 | $this->assertEqual($this->testBundle->get('type'), 'twitter', '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'), $field_map, 'Correct field map detected.'); |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Tests item creation. |
|
88 | - */ |
|
89 | - public function testMediaBundleItemCreation() { |
|
86 | + /** |
|
87 | + * Tests item creation. |
|
88 | + */ |
|
89 | + public function testMediaBundleItemCreation() { |
|
90 | 90 | // Define the media item name. |
91 | 91 | $name = $this->randomMachineName(); |
92 | 92 | $tweet_url = 'https://twitter.com/jack/status/20'; |
93 | 93 | $edit = [ |
94 | - 'name[0][value]' => $name, |
|
95 | - 'field_tweet_url[0][uri]' => $tweet_url, |
|
94 | + 'name[0][value]' => $name, |
|
95 | + 'field_tweet_url[0][uri]' => $tweet_url, |
|
96 | 96 | ]; |
97 | 97 | |
98 | 98 | // Save the tweet. |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | $media_id = $this->container->get('entity.query')->get('media')->condition('bundle', 'tweet')->sort('created', 'DESC')->execute(); |
102 | 102 | $media_id = reset($media_id); |
103 | 103 | $media = $this->container->get('entity_type.manager') |
104 | - ->getStorage('media') |
|
105 | - ->loadUnchanged($media_id); |
|
104 | + ->getStorage('media') |
|
105 | + ->loadUnchanged($media_id); |
|
106 | 106 | $properties = $media->toArray(); |
107 | 107 | $this->assertEqual($media->get('field_tweet_author')[0]->getValue()['value'], "jack", "Correct tweet author stored."); |
108 | 108 | $this->assertEqual($media->get('field_tweet_id')[0]->getValue()['value'], "20", "Correct tweet id stored."); |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | 111 | } |