Browse Source

Drupal Rector.

MNPALS-2.x
Rosie Le Faive 1 year ago
parent
commit
7d7f97746a
  1. 3
      modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php
  2. 4
      modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php
  3. 3
      modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php
  4. 2
      modules/islandora_text_extraction/src/Controller/MediaSourceController.php
  5. 4
      modules/islandora_text_extraction/tests/src/Functional/LoadTest.php
  6. 3
      modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php
  7. 6
      src/EventSubscriber/LinkHeaderSubscriber.php
  8. 4
      src/EventSubscriber/MediaLinkHeaderSubscriber.php
  9. 6
      src/EventSubscriber/NodeLinkHeaderSubscriber.php
  10. 14
      src/Flysystem/Adapter/FedoraAdapter.php
  11. 7
      src/Form/AddChildrenWizard/AbstractFileSelectionForm.php
  12. 2
      tests/src/Functional/AddChildTest.php
  13. 2
      tests/src/Functional/AddMediaToNodeTest.php
  14. 3
      tests/src/Functional/ContentEntityTypeTest.php
  15. 4
      tests/src/Functional/DeleteMediaTest.php
  16. 5
      tests/src/Functional/DerivativeReactionTest.php
  17. 2
      tests/src/Functional/GenerateDerivativeTestBase.php
  18. 5
      tests/src/Functional/IndexingTest.php
  19. 11
      tests/src/Functional/IslandoraFunctionalTestBase.php
  20. 2
      tests/src/Functional/IslandoraImageFormatterTest.php
  21. 17
      tests/src/Functional/IslandoraSettingsFormTest.php
  22. 13
      tests/src/Functional/JsonldSelfReferenceReactionTest.php
  23. 14
      tests/src/Functional/JsonldTypeAlterReactionTest.php
  24. 2
      tests/src/Functional/LinkHeaderTest.php
  25. 2
      tests/src/Functional/MediaSourceUpdateTest.php
  26. 2
      tests/src/Functional/NodeHasTermTest.php
  27. 2
      tests/src/Functional/ViewModeAlterReactionTest.php
  28. 2
      tests/src/FunctionalJavascript/IntegerWeightTest.php
  29. 2
      tests/src/Kernel/EventGeneratorTest.php
  30. 12
      tests/src/Kernel/FedoraAdapterTest.php
  31. 4
      tests/src/Kernel/IslandoraKernelTestBase.php
  32. 4
      tests/src/Kernel/JwtEventSubscriberTest.php

3
modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php

@ -68,7 +68,8 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase {
'field_media_of[0][target_id]' => 'Test Node',
'field_tags[0][target_id]' => 'Preservation Master',
];
$this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
$this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save'));
$expected = [
'source_uri' => 'test_file.txt',

4
modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php

@ -20,7 +20,7 @@ class BreadcrumbsTest extends IslandoraFunctionalTestBase {
*
* @var array
*/
public static $modules = [
protected static $modules = [
'islandora_breadcrumbs',
];
@ -56,7 +56,7 @@ class BreadcrumbsTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Create some nodes.

3
modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php

@ -70,7 +70,8 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase {
'field_media_of[0][target_id]' => 'Test Node',
'field_tags[0][target_id]' => 'Preservation Master',
];
$this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
$this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save'));
$expected = [
'source_uri' => 'test_file.txt',

2
modules/islandora_text_extraction/src/Controller/MediaSourceController.php

@ -98,7 +98,7 @@ class MediaSourceController extends ControllerBase {
if (!$this->fileSystem->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
throw new HttpException(500, "The destination directory does not exist, could not be created, or is not writable");
}
$file = file_save_data($contents, $content_location, FileSystemInterface::EXISTS_REPLACE);
$file = \Drupal::service('file.repository')->writeData($contents, $content_location, FileSystemInterface::EXISTS_REPLACE);
if ($media->hasField($destination_field)) {
$media->{$destination_field}->setValue([
'target_id' => $file->id(),

4
modules/islandora_text_extraction/tests/src/Functional/LoadTest.php

@ -17,7 +17,7 @@ class LoadTest extends IslandoraFunctionalTestBase {
*
* @var array
*/
public static $modules = ['islandora_text_extraction'];
protected static $modules = ['islandora_text_extraction'];
/**
* A user with permission to administer site configuration.
@ -29,7 +29,7 @@ class LoadTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->user = $this->drupalCreateUser(['administer site configuration']);
$this->drupalLogin($this->user);

3
modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php

@ -65,7 +65,8 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase {
'field_media_of[0][target_id]' => 'Test Node',
'field_tags[0][target_id]' => 'Preservation Master',
];
$this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
$this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save'));
$expected = [
'source_uri' => 'test_file.txt',

6
src/EventSubscriber/LinkHeaderSubscriber.php

@ -2,6 +2,7 @@
namespace Drupal\islandora\EventSubscriber;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Drupal\Core\Access\AccessManagerInterface;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityInterface;
@ -13,7 +14,6 @@ use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
/**
@ -312,9 +312,9 @@ abstract class LinkHeaderSubscriber implements EventSubscriberInterface {
/**
* Adds resource-specific link headers to appropriate responses.
*
* @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
* @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event
* Event containing the response.
*/
abstract public function onResponse(FilterResponseEvent $event);
abstract public function onResponse(ResponseEvent $event);
}

4
src/EventSubscriber/MediaLinkHeaderSubscriber.php

@ -2,10 +2,10 @@
namespace Drupal\islandora\EventSubscriber;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Drupal\Core\Url;
use Drupal\media\MediaInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
/**
* Subscribes to MediaLinkHeader Event.
@ -17,7 +17,7 @@ class MediaLinkHeaderSubscriber extends LinkHeaderSubscriber implements EventSub
/**
* {@inheritdoc}
*/
public function onResponse(FilterResponseEvent $event) {
public function onResponse(ResponseEvent $event) {
$response = $event->getResponse();
$media = $this->getObject($response, 'media');

6
src/EventSubscriber/NodeLinkHeaderSubscriber.php

@ -2,9 +2,9 @@
namespace Drupal\islandora\EventSubscriber;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Drupal\node\NodeInterface;
use Drupal\islandora\IslandoraUtils;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
@ -17,10 +17,10 @@ class NodeLinkHeaderSubscriber extends LinkHeaderSubscriber implements EventSubs
/**
* Adds node-specific link headers to appropriate responses.
*
* @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
* @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event
* Event containing the response.
*/
public function onResponse(FilterResponseEvent $event) {
public function onResponse(ResponseEvent $event) {
$response = $event->getResponse();
$node = $this->getObject($response, 'node');

14
src/Flysystem/Adapter/FedoraAdapter.php

@ -2,6 +2,8 @@
namespace Drupal\islandora\Flysystem\Adapter;
use GuzzleHttp\Psr7\Header;
use function GuzzleHttp\Psr7\parse_header;
use Drupal\Core\Logger\LoggerChannelInterface;
use Islandora\Chullo\IFedoraApi;
use League\Flysystem\AdapterInterface;
@ -159,11 +161,11 @@ class FedoraAdapter implements AdapterInterface {
// directory.
$type = 'dir';
// phpcs:disable
if (class_exists(\GuzzleHttp\Psr7\Header::class)) {
$links = \GuzzleHttp\Psr7\Header::parse($response->getHeader('Link'));
if (class_exists(Header::class)) {
$links = Header::parse($response->getHeader('Link'));
}
else {
$links = \GuzzleHttp\Psr7\parse_header($response->getHeader('Link'));
$links = parse_header($response->getHeader('Link'));
}
// phpcs:enable
foreach ($links as $link) {
@ -402,11 +404,11 @@ class FedoraAdapter implements AdapterInterface {
if ($response->getStatusCode() == 410) {
$return = FALSE;
// phpcs:disable
if (class_exists(\GuzzleHttp\Psr7\Header::class)) {
$link_headers = \GuzzleHttp\Psr7\Header::parse($response->getHeader('Link'));
if (class_exists(Header::class)) {
$link_headers = Header::parse($response->getHeader('Link'));
}
else {
$link_headers = \GuzzleHttp\Psr7\parse_header($response->getHeader('Link'));
$link_headers = parse_header($response->getHeader('Link'));
}
// phpcs:enable
if ($link_headers) {

7
src/Form/AddChildrenWizard/AbstractFileSelectionForm.php

@ -37,6 +37,11 @@ abstract class AbstractFileSelectionForm extends FormBase {
* @var \Drupal\islandora\Form\AddChildrenWizard\AbstractBatchProcessor|null
*/
protected ?AbstractBatchProcessor $batchProcessor;
private \static $static;
public function __construct(\static $static)
{
$this->static = $static;
}
/**
* {@inheritdoc}
@ -49,7 +54,7 @@ abstract class AbstractFileSelectionForm extends FormBase {
$instance->entityFieldManager = $container->get('entity_field.manager');
$instance->currentUser = $container->get('current_user');
$instance->batchProcessor = $container->get(static::BATCH_PROCESSOR);
$instance->batchProcessor = $this->static;
return $instance;
}

2
tests/src/Functional/AddChildTest.php

@ -12,7 +12,7 @@ class AddChildTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->parent =

2
tests/src/Functional/AddMediaToNodeTest.php

@ -31,7 +31,7 @@ class AddMediaToNodeTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->node = $this->container->get('entity_type.manager')->getStorage('node')->create([

3
tests/src/Functional/ContentEntityTypeTest.php

@ -52,7 +52,8 @@ class ContentEntityTypeTest extends IslandoraFunctionalTestBase {
'name[0][value]' => 'Test Media',
'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
];
$this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
$this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save'));
$this->assertSession()->pageTextNotContains("Hello World!");
}

4
tests/src/Functional/DeleteMediaTest.php

@ -16,7 +16,7 @@ class DeleteMediaTest extends IslandoraFunctionalTestBase {
*
* @var array
*/
public static $modules = [
protected static $modules = [
'media_test_views',
'context_ui',
'field_ui',
@ -47,7 +47,7 @@ class DeleteMediaTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Create a test user.

5
tests/src/Functional/DerivativeReactionTest.php

@ -19,7 +19,7 @@ class DerivativeReactionTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->node = $this->container->get('entity_type.manager')->getStorage('node')->create([
@ -52,7 +52,8 @@ class DerivativeReactionTest extends IslandoraFunctionalTestBase {
'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt',
'field_media_of[0][target_id]' => 'Test Node',
];
$this->drupalPostForm('media/add/' . $this->testMediaType->id(), $values, $this->t('Save'));
$this->drupalGet('media/add/' . $this->testMediaType->id());
$this->submitForm($values, $this->t('Save'));
// field_media_of is set and there's a file, so derivatives should fire.
$this->assertSession()->pageTextContains("Hello World!");

2
tests/src/Functional/GenerateDerivativeTestBase.php

@ -29,7 +29,7 @@ abstract class GenerateDerivativeTestBase extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->createUserAndLogin();

5
tests/src/Functional/IndexingTest.php

@ -12,7 +12,7 @@ class IndexingTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Create an action that dsm's "Goodbye, Cruel World!".
@ -63,9 +63,10 @@ class IndexingTest extends IslandoraFunctionalTestBase {
// Add the Goodbye World reaction.
$this->addPresetReaction('test', 'delete', 'goodbye_world');
$this->drupalGet("$url/delete");
// Delete the node.
$this->drupalPostForm("$url/delete", [], $this->t('Delete'));
$this->submitForm([], $this->t('Delete'));
$this->assertSession()->statusCodeEquals(200);
// Confirm Goodbye, Cruel World! is printed to the screen.

11
tests/src/Functional/IslandoraFunctionalTestBase.php

@ -88,7 +88,7 @@ class IslandoraFunctionalTestBase extends BrowserTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Delete the node rest config that's bootstrapped with Drupal.
@ -314,7 +314,8 @@ EOD;
* Create a new node by posting its add form.
*/
protected function postNodeAddForm($bundle_id, $values, $button_text) {
$this->drupalPostForm("node/add/$bundle_id", $values, $this->t('@text', ['@text' => $button_text]));
$this->drupalGet("node/add/$bundle_id");
$this->submitForm($values, $this->t('@text', ['@text' => $button_text]));
$this->assertSession()->statusCodeEquals(200);
}
@ -322,7 +323,8 @@ EOD;
* Create a new node by posting its add form.
*/
protected function postTermAddForm($taxomony_id, $values, $button_text) {
$this->drupalPostForm("admin/structure/taxonomy/manage/$taxomony_id/add", $values, $this->t('@text', ['@text' => $button_text]));
$this->drupalGet("admin/structure/taxonomy/manage/$taxomony_id/add");
$this->submitForm($values, $this->t('@text', ['@text' => $button_text]));
$this->assertSession()->statusCodeEquals(200);
}
@ -330,7 +332,8 @@ EOD;
* Edits a node by posting its edit form.
*/
protected function postEntityEditForm($entity_url, $values, $button_text) {
$this->drupalPostForm("$entity_url/edit", $values, $this->t('@text', ['@text' => $button_text]));
$this->drupalGet("$entity_url/edit");
$this->submitForm($values, $this->t('@text', ['@text' => $button_text]));
$this->assertSession()->statusCodeEquals(200);
}

2
tests/src/Functional/IslandoraImageFormatterTest.php

@ -92,7 +92,7 @@ class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase {
':title' => 'Some Title',
]
);
$this->assertEqual(count($elements), 1, 'Image linked to content formatter displaying points to Node and not Media.');
$this->assertEquals(count($elements), 1, 'Image linked to content formatter displaying points to Node and not Media.');
}
}

17
tests/src/Functional/IslandoraSettingsFormTest.php

@ -14,7 +14,7 @@ class IslandoraSettingsFormTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Create a test user.
@ -36,20 +36,25 @@ class IslandoraSettingsFormTest extends IslandoraFunctionalTestBase {
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains("JWT Expiry");
$this->assertSession()->fieldValueEquals('edit-jwt-expiry', '+2 hour');
$this->drupalGet('/admin/config/islandora/core');
// Blank is not allowed.
$this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => ""], $this->t('Save configuration'));
$this->submitForm(['edit-jwt-expiry' => ""], $this->t('Save configuration'));
$this->assertSession()->pageTextContainsOnce('"" is not a valid time or interval expression.');
$this->drupalGet('/admin/config/islandora/core');
// Negative is not allowed.
$this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => "-2 hours"], $this->t('Save configuration'));
$this->submitForm(['edit-jwt-expiry' => "-2 hours"], $this->t('Save configuration'));
$this->assertSession()->pageTextContainsOnce('Time or interval expression cannot be negative');
$this->drupalGet('/admin/config/islandora/core');
// Must include an integer value.
$this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => "last hour"], $this->t('Save configuration'));
$this->submitForm(['edit-jwt-expiry' => "last hour"], $this->t('Save configuration'));
$this->assertSession()->pageTextContainsOnce('No numeric interval specified, for example "1 day"');
$this->drupalGet('/admin/config/islandora/core');
// Must have an accepted interval.
$this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => "1 fortnight"], $this->t('Save configuration'));
$this->submitForm(['edit-jwt-expiry' => "1 fortnight"], $this->t('Save configuration'));
$this->assertSession()->pageTextContainsOnce('No time interval found, please include one of');
$this->drupalGet('/admin/config/islandora/core');
// Test a valid setting.
$this->drupalPostForm('/admin/config/islandora/core', ['edit-jwt-expiry' => "2 weeks"], $this->t('Save configuration'));
$this->submitForm(['edit-jwt-expiry' => "2 weeks"], $this->t('Save configuration'));
$this->assertSession()->pageTextContainsOnce('The configuration options have been saved.');
}

13
tests/src/Functional/JsonldSelfReferenceReactionTest.php

@ -2,6 +2,7 @@
namespace Drupal\Tests\islandora\Functional;
use function GuzzleHttp\json_decode;
/**
* Class MappingUriPredicateReactionTest.
*
@ -13,7 +14,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$types = ['schema:Thing'];
@ -61,7 +62,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
$contents = $this->drupalGet($url . '?_format=jsonld');
$this->assertSession()->statusCodeEquals(200);
$json = \GuzzleHttp\json_decode($contents, TRUE);
$json = json_decode($contents, TRUE);
$this->assertArrayHasKey('http://purl.org/dc/terms/title',
$json['@graph'][0], 'Missing dcterms:title key');
$this->assertEquals(
@ -103,7 +104,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
drupal_flush_all_caches();
$new_contents = $this->drupalGet($url . '?_format=jsonld');
$json = \GuzzleHttp\json_decode($new_contents, TRUE);
$json = json_decode($new_contents, TRUE);
$this->assertEquals(
'Test Node',
$json['@graph'][0]['http://purl.org/dc/terms/title'][0]['@value'],
@ -123,7 +124,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
$this->assertSession()
->pageTextContains("The context $context_name has been saved");
$new_contents = $this->drupalGet($url . '?_format=jsonld');
$json = \GuzzleHttp\json_decode($new_contents, TRUE);
$json = json_decode($new_contents, TRUE);
$this->assertEquals(
'Test Node',
$json['@graph'][0]['http://purl.org/dc/terms/title'][0]['@value'],
@ -161,7 +162,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
$contents = $this->drupalGet($media_url . '?_format=jsonld');
$this->assertSession()->statusCodeEquals(200);
$json = \GuzzleHttp\json_decode($contents, TRUE);
$json = json_decode($contents, TRUE);
$this->assertEquals(
"$media_url?_format=jsonld",
$json['@graph'][0]['@id'],
@ -186,7 +187,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase {
drupal_flush_all_caches();
$new_contents = $this->drupalGet($media_url . '?_format=jsonld');
$json = \GuzzleHttp\json_decode($new_contents, TRUE);
$json = json_decode($new_contents, TRUE);
$this->assertEquals(
"$media_url?_format=jsonld",
$json['@graph'][0]['http://www.iana.org/assignments/relation/describedby'][0]['@id'],

14
tests/src/Functional/JsonldTypeAlterReactionTest.php

@ -2,6 +2,7 @@
namespace Drupal\Tests\islandora\Functional;
use function GuzzleHttp\json_decode;
/**
* Tests Jsonld Alter Reaction.
*
@ -20,17 +21,18 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
'administer node fields',
]);
$this->drupalLogin($account);
$this->drupalGet('admin/structure/types/manage/test_type/fields/add-field');
// Add the typed predicate we will select in the reaction config.
// Taken from FieldUiTestTrait->fieldUIAddNewField.
$this->drupalPostForm('admin/structure/types/manage/test_type/fields/add-field', [
$this->submitForm([
'new_storage_type' => 'string',
'label' => 'Typed Predicate',
'field_name' => 'type_predicate',
], $this->t('Save and continue'));
$this->drupalPostForm(NULL, [], $this->t('Save field settings'));
$this->drupalPostForm(NULL, [], $this->t('Save settings'));
$this->assertRaw('field_type_predicate', 'Redirected to "Manage fields" page.');
$this->submitForm([], $this->t('Save field settings'));
$this->submitForm([], $this->t('Save settings'));
$this->assertSession()->responseContains('field_type_predicate');
// Add the test node.
$this->postNodeAddForm('test_type', [
@ -46,7 +48,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
$contents = $this->drupalGet($url . '?_format=jsonld');
$this->assertSession()->statusCodeEquals(200);
$json = \GuzzleHttp\json_decode($contents, TRUE);
$json = json_decode($contents, TRUE);
$this->assertArrayHasKey('@type',
$json['@graph'][0], 'Missing @type');
$this->assertEquals(
@ -81,7 +83,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest {
// Check for the new @type from the field_type_predicate value.
$new_contents = $this->drupalGet($url . '?_format=jsonld');
$json = \GuzzleHttp\json_decode($new_contents, TRUE);
$json = json_decode($new_contents, TRUE);
$this->assertTrue(
in_array('http://schema.org/Organization', $json['@graph'][0]['@type']),
'Missing altered @type value of http://schema.org/Organization'

2
tests/src/Functional/LinkHeaderTest.php

@ -42,7 +42,7 @@ class LinkHeaderTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$account = $this->createUserAndLogin();

2
tests/src/Functional/MediaSourceUpdateTest.php

@ -35,7 +35,7 @@ class MediaSourceUpdateTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Make a user with appropriate permissions.

2
tests/src/Functional/NodeHasTermTest.php

@ -13,7 +13,7 @@ class NodeHasTermTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();

2
tests/src/Functional/ViewModeAlterReactionTest.php

@ -26,7 +26,7 @@ class ViewModeAlterReactionTest extends IslandoraFunctionalTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Node to be referenced via member of.

2
tests/src/FunctionalJavascript/IntegerWeightTest.php

@ -80,7 +80,7 @@ class IntegerWeightTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(

2
tests/src/Kernel/EventGeneratorTest.php

@ -41,7 +41,7 @@ class EventGeneratorTest extends IslandoraKernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Create a test user.

12
tests/src/Kernel/FedoraAdapterTest.php

@ -2,6 +2,9 @@
namespace Drupal\Tests\islandora\Kernel;
use Prophecy\PhpUnit\ProphecyTrait;
use GuzzleHttp\Psr7\Utils;
use function GuzzleHttp\Psr7\stream_for;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\islandora\Flysystem\Adapter\FedoraAdapter;
use GuzzleHttp\Psr7\Response;
@ -18,6 +21,7 @@ use Symfony\Component\Mime\MimeTypeGuesserInterface;
*/
class FedoraAdapterTest extends IslandoraKernelTestBase {
use ProphecyTrait;
/**
* A mimetype guesser prophecy.
*
@ -35,7 +39,7 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->mimeGuesser = $this->prophesize(MimeTypeGuesserInterface::class)
->reveal();
@ -58,10 +62,10 @@ class FedoraAdapterTest extends IslandoraKernelTestBase {
$prophecy->getHeader('Content-Type')->willReturn(['text/plain']);
$prophecy->getHeader('Content-Length')->willReturn([strlen("DERP")]);
// phpcs:disable
if (class_exists(\GuzzleHttp\Psr7\Utils::class)) {
$prophecy->getBody()->willReturn(\GuzzleHttp\Psr7\Utils::streamFor("DERP"));
if (class_exists(Utils::class)) {
$prophecy->getBody()->willReturn(Utils::streamFor("DERP"));
} else {
$prophecy->getBody()->willReturn(\GuzzleHttp\Psr7\stream_for("DERP"));
$prophecy->getBody()->willReturn(stream_for("DERP"));
}
// phpcs:enable
return $prophecy;

4
tests/src/Kernel/IslandoraKernelTestBase.php

@ -12,7 +12,7 @@ abstract class IslandoraKernelTestBase extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
protected static $modules = [
'system',
'user',
'field',
@ -43,7 +43,7 @@ abstract class IslandoraKernelTestBase extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// Bootstrap minimal Drupal environment to run the tests.

4
tests/src/Kernel/JwtEventSubscriberTest.php

@ -2,6 +2,7 @@
namespace Drupal\Tests\islandora\Kernel;
use Prophecy\PhpUnit\ProphecyTrait;
use Drupal\jwt\Authentication\Event\JwtAuthGenerateEvent;
use Drupal\jwt\Authentication\Event\JwtAuthValidEvent;
use Drupal\jwt\Authentication\Event\JwtAuthValidateEvent;
@ -19,6 +20,7 @@ use Drupal\islandora\EventSubscriber\JwtEventSubscriber;
*/
class JwtEventSubscriberTest extends IslandoraKernelTestBase {
use ProphecyTrait;
use UserCreationTrait;
/**
@ -31,7 +33,7 @@ class JwtEventSubscriberTest extends IslandoraKernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->user = $this->createUser();

Loading…
Cancel
Save