comparison core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
158 158
159 /** @var \Drupal\media\MediaTypeInterface $loaded_media_type */ 159 /** @var \Drupal\media\MediaTypeInterface $loaded_media_type */
160 $loaded_media_type = $this->container->get('entity_type.manager') 160 $loaded_media_type = $this->container->get('entity_type.manager')
161 ->getStorage('media_type') 161 ->getStorage('media_type')
162 ->load($this->testMediaType->id()); 162 ->load($this->testMediaType->id());
163 $this->assertEquals($loaded_media_type->id(), $this->testMediaType->id()); 163 $this->assertSame($loaded_media_type->id(), $this->testMediaType->id());
164 $this->assertEquals($loaded_media_type->label(), $new_name); 164 $this->assertSame($loaded_media_type->label(), $new_name);
165 $this->assertEquals($loaded_media_type->getDescription(), $new_description); 165 $this->assertSame($loaded_media_type->getDescription(), $new_description);
166 $this->assertEquals($loaded_media_type->getSource()->getPluginId(), 'test'); 166 $this->assertSame($loaded_media_type->getSource()->getPluginId(), 'test');
167 $this->assertEquals($loaded_media_type->getSource()->getConfiguration()['test_config_value'], 'This is new config value.'); 167 $this->assertSame($loaded_media_type->getSource()->getConfiguration()['test_config_value'], 'This is new config value.');
168 $this->assertTrue($loaded_media_type->shouldCreateNewRevision()); 168 $this->assertTrue($loaded_media_type->shouldCreateNewRevision());
169 $this->assertTrue($loaded_media_type->thumbnailDownloadsAreQueued()); 169 $this->assertTrue($loaded_media_type->thumbnailDownloadsAreQueued());
170 $this->assertFalse($loaded_media_type->getStatus()); 170 $this->assertFalse($loaded_media_type->getStatus());
171 $this->assertEquals($loaded_media_type->getFieldMap(), ['attribute_1' => 'name']); 171 $this->assertSame($loaded_media_type->getFieldMap(), ['attribute_1' => 'name']);
172 172
173 // We need to clear the statically cached field definitions to account for 173 // We need to clear the statically cached field definitions to account for
174 // fields that have been created by API calls in this test, since they exist 174 // fields that have been created by API calls in this test, since they exist
175 // in a separate memory space from the web server. 175 // in a separate memory space from the web server.
176 $this->container->get('entity_field.manager')->clearCachedFieldDefinitions(); 176 $this->container->get('entity_field.manager')->clearCachedFieldDefinitions();
189 $assert_session->addressEquals('admin/structure/media'); 189 $assert_session->addressEquals('admin/structure/media');
190 $assert_session->pageTextContains('The media type ' . $new_name . ' has been deleted.'); 190 $assert_session->pageTextContains('The media type ' . $new_name . ' has been deleted.');
191 191
192 // Test that the system for preventing the deletion of media types works 192 // Test that the system for preventing the deletion of media types works
193 // (they cannot be deleted if there is media content of that type/bundle). 193 // (they cannot be deleted if there is media content of that type/bundle).
194 $media_type2 = $this->createMediaType(); 194 $media_type2 = $this->createMediaType('test');
195 $label2 = $media_type2->label(); 195 $label2 = $media_type2->label();
196 $media = Media::create(['name' => 'lorem ipsum', 'bundle' => $media_type2->id()]); 196 $media = Media::create(['name' => 'lorem ipsum', 'bundle' => $media_type2->id()]);
197 $media->save(); 197 $media->save();
198 $this->drupalGet('admin/structure/media/manage/' . $media_type2->id()); 198 $this->drupalGet('admin/structure/media/manage/' . $media_type2->id());
199 $page->clickLink('Delete'); 199 $page->clickLink('Delete');