Browse Source

fix deprecations in tests

d9_islandora
Eli Zoller 4 years ago
parent
commit
96b496a360
  1. 2
      tests/src/Functional/AddMediaToNodeTest.php
  2. 4
      tests/src/Functional/IslandoraImageFormatterTest.php
  3. 2
      tests/src/Functional/JsonldSelfReferenceReactionTest.php
  4. 5
      tests/src/Functional/LinkHeaderTest.php
  5. 10
      tests/src/Functional/MediaSourceUpdateTest.php
  6. 2
      tests/src/Functional/ViewModeAlterReactionTest.php

2
tests/src/Functional/AddMediaToNodeTest.php

@ -3,7 +3,7 @@
namespace Drupal\Tests\islandora\Functional;
use Drupal\Core\Url;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
/**
* Tests the RelatedLinkHeader view alter.

4
tests/src/Functional/IslandoraImageFormatterTest.php

@ -34,7 +34,7 @@ class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase {
'type' => 'islandora_image',
'settings' => ['image_style' => NULL, 'image_link' => 'content'],
];
$display = entity_get_display('media', $testImageMediaType->id(), 'default');
$display = $this->container->get('entity_display.repository')->getViewDisplay('media', $testImageMediaType->id(), 'default');
$display->setComponent('field_media_image', $display_options)
->removeComponent('created')
->removeComponent('uid')
@ -81,7 +81,7 @@ class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase {
$elements = $this->xpath(
'//a[@href=:path]/img[@src=:url and @alt=:alt and @title=:title]',
[
':path' => $node->url(),
':path' => $node->toUrl()->toString(),
':url' => file_url_transform_relative(file_create_url($file->getFileUri())),
':alt' => 'Some Alt',
':title' => 'Some Title',

2
tests/src/Functional/JsonldSelfReferenceReactionTest.php

@ -154,7 +154,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
list($file, $media) = $this->makeMediaAndFile($account);
$media_url = $media->url('canonical', ['absolute' => TRUE]);
$file_url = $file->url('canonical', ['absolute' => TRUE]);
$file_url = $file->createFileUrl(FALSE);
$this->drupalGet($media_url);
$this->assertSession()->statusCodeEquals(200);

5
tests/src/Functional/LinkHeaderTest.php

@ -135,15 +135,14 @@ class LinkHeaderTest extends IslandoraFunctionalTestBase {
public function testMediaLinkHeaders() {
// Get the file to check its url in the response headers.
$file_url = $this->file->url('canonical', ['absolute' => TRUE]);
$file_url = $this->file->createFileUrl(FALSE);
$rest_url = Url::fromRoute('islandora.media_source_update', ['media' => $this->media->id()])
->setAbsolute()
->toString();
$media_url = $this->media->url('canonical', ['absolute' => TRUE]);
$media_url = $this->media->toUrl('canonical', ['absolute' => TRUE]);
// Perform a GET request as anonymous.
$this->drupalGet($media_url, [], ['Cache-Control: no-cache']);
// Check link headers.
$this->assertTrue(
$this->validateLinkHeaderWithUrl('describes', $file_url, '', 'text/plain') == 1,

10
tests/src/Functional/MediaSourceUpdateTest.php

@ -84,7 +84,7 @@ class MediaSourceUpdateTest extends IslandoraFunctionalTestBase {
// Update without Content-Type header should fail with 400.
$options = [
'auth' => [$this->account->getUsername(), $this->account->pass_raw],
'auth' => [$this->account->getAccountName(), $this->account->pass_raw],
'http_errors' => FALSE,
'body' => $file_contents,
];
@ -93,7 +93,7 @@ class MediaSourceUpdateTest extends IslandoraFunctionalTestBase {
// Update without body should fail with 400.
$options = [
'auth' => [$this->account->getUsername(), $this->account->pass_raw],
'auth' => [$this->account->getAccountName(), $this->account->pass_raw],
'http_errors' => FALSE,
'headers' => [
'Content-Type' => 'text/plain',
@ -104,7 +104,7 @@ class MediaSourceUpdateTest extends IslandoraFunctionalTestBase {
// Should be successful.
$options = [
'auth' => [$this->account->getUsername(), $this->account->pass_raw],
'auth' => [$this->account->getAccountName(), $this->account->pass_raw],
'http_errors' => FALSE,
'headers' => [
'Content-Type' => 'text/plain',
@ -116,10 +116,10 @@ class MediaSourceUpdateTest extends IslandoraFunctionalTestBase {
// GET the media and compare file and metadata.
$options = [
'auth' => [$this->account->getUsername(), $this->account->pass_raw],
'auth' => [$this->account->getAccountName(), $this->account->pass_raw],
'http_errors' => FALSE,
];
$url = $this->media->url('canonical', ['absolute' => TRUE]);
$url = $this->media->toUrl('canonical', ['absolute' => TRUE])->toString();
$response = $client->request('GET', $url . '?_format=json', $options);
$updated = json_decode($response->getBody(), TRUE);

2
tests/src/Functional/ViewModeAlterReactionTest.php

@ -64,7 +64,7 @@ class ViewModeAlterReactionTest extends IslandoraFunctionalTestBase {
$this->drupalLogin($account);
// Stash the node's url.
$url = $this->referencer->url('canonical', ['absolute' => TRUE]);
$url = $this->referencer->toUrl('canonical', ['absolute' => TRUE]);
$this->drupalGet($url);
// Make sure we're viewing the default (e.g. the media field is displayed).

Loading…
Cancel
Save