Mercurial > hg > isophonics-drupal-site
diff core/modules/media/tests/src/Functional/MediaRevisionTest.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 |
line wrap: on
line diff
--- a/core/modules/media/tests/src/Functional/MediaRevisionTest.php Tue Jul 10 15:07:59 2018 +0100 +++ b/core/modules/media/tests/src/Functional/MediaRevisionTest.php Thu Feb 28 13:21:36 2019 +0000 @@ -25,7 +25,7 @@ $media_storage = $this->container->get('entity.manager')->getStorage('media'); // Create a media type and media item. - $media_type = $this->createMediaType(); + $media_type = $this->createMediaType('test'); $media = $media_storage->create([ 'bundle' => $media_type->id(), 'name' => 'Unnamed', @@ -80,7 +80,7 @@ $uri = 'temporary://foo.txt'; file_put_contents($uri, $this->randomString(128)); - $this->createMediaType(['bundle' => 'file', 'new_revision' => TRUE], 'file'); + $this->createMediaType('file', ['id' => 'file', 'new_revision' => TRUE]); // Create a media item. $this->drupalGet('/media/add/file'); @@ -88,7 +88,7 @@ $page->fillField('Name', 'Foobar'); $page->attachFileToField('File', $this->container->get('file_system')->realpath($uri)); $page->pressButton('Save'); - $assert->addressMatches('/^\/media\/[0-9]+$/'); + $assert->addressEquals('admin/content/media'); // The media item was just created, so it should only have one revision. $media = $this->container @@ -119,7 +119,7 @@ public function testImageMediaRevision() { $assert = $this->assertSession(); - $this->createMediaType(['bundle' => 'image', 'new_revision' => TRUE], 'image'); + $this->createMediaType('image', ['id' => 'image', 'new_revision' => TRUE]); /** @var \Drupal\field\FieldConfigInterface $field */ // Disable the alt text field, because this is not a JavaScript test and @@ -135,9 +135,9 @@ $this->drupalGet('/media/add/image'); $page = $this->getSession()->getPage(); $page->fillField('Name', 'Foobar'); - $page->attachFileToField('Image', \Drupal::root() . '/core/modules/media/tests/fixtures/example_1.jpeg'); + $page->attachFileToField('Image', $this->root . '/core/modules/media/tests/fixtures/example_1.jpeg'); $page->pressButton('Save'); - $assert->addressMatches('/^\/media\/[0-9]+$/'); + $assert->addressEquals('admin/content/media'); // The media item was just created, so it should only have one revision. $media = $this->container @@ -190,8 +190,9 @@ $entity_type = $entity->getEntityType(); $count = $this->container - ->get('entity.query') - ->get($entity_type->id()) + ->get('entity_type.manager') + ->getStorage($entity_type->id()) + ->getQuery() ->count() ->allRevisions() ->condition($entity_type->getKey('id'), $entity->id())