Skip to content
Snippets Groups Projects
Commit d807e97b authored by Jeroen Tubex's avatar Jeroen Tubex Committed by Carsten Logemann
Browse files

Issue #3136822 by shubhangi1995, JeroenT: Remove Drupal 9 deprecations

parent f443a771
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@
},
"license": "GPL-2.0+",
"require": {
"drupal/core": "^8.6.0",
"drupal/core": "^8.8.0 || ^9",
"drupal/dynamic_entity_reference": "^1.0"
},
"extra": {
......
name: 'Link checker'
type: module
description: 'Periodically checks for broken links in content.'
core: 8.x
core_version_requirement: ^8.8 || ^9
configure: linkchecker.admin_settings_form
dependencies:
- dynamic_entity_reference:dynamic_entity_reference (>= 1.0)
......
......@@ -5,7 +5,8 @@ namespace Drupal\linkchecker\Form;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -25,8 +26,8 @@ class LinkCheckerLinkForm extends ContentEntityForm {
/**
* LinkCheckerLinkEditForm constructor.
*/
public function __construct(EntityManagerInterface $entity_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL, DateFormatterInterface $dateFormatter) {
parent::__construct($entity_manager, $entity_type_bundle_info, $time);
public function __construct(EntityRepositoryInterface $entity_repository, EntityTypeBundleInfoInterface $entity_type_bundle_info, TimeInterface $time, DateFormatterInterface $dateFormatter) {
parent::__construct($entity_repository, $entity_type_bundle_info, $time);
$this->dateFormatter = $dateFormatter;
}
......@@ -35,7 +36,7 @@ class LinkCheckerLinkForm extends ContentEntityForm {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
$container->get('entity.repository'),
$container->get('entity_type.bundle.info'),
$container->get('datetime.time'),
$container->get('date.formatter')
......
......@@ -38,6 +38,7 @@ class LinkCheckerLinkAccessTest extends KernelTestBase {
'filter',
'field',
'text',
'path_alias',
'dynamic_entity_reference',
'linkchecker',
];
......
......@@ -30,7 +30,7 @@ class LinkcheckerLinkExtractorServiceTest extends KernelTestBase {
'text',
'dynamic_entity_reference',
'linkchecker',
'path',
'path_alias',
];
/**
......
......@@ -32,7 +32,7 @@ class LinkcheckerRepair301Test extends KernelTestBase {
'text',
'dynamic_entity_reference',
'linkchecker',
'path',
'path_alias',
];
/**
......@@ -170,7 +170,7 @@ class LinkcheckerRepair301Test extends KernelTestBase {
// Put link inside href attribute to be sure that it was replaced
// without errors.
$this->assertFalse(strpos($body, 'href="' . $link->getUrl() . '"'));
$this->assertTrue(strpos($body, 'href="https://existing.com/redirect"'));
$this->assertNotFalse(strpos($body, 'href="https://existing.com/redirect"'));
// Test internal link.
$link = LinkCheckerLink::create([
......@@ -194,7 +194,7 @@ class LinkcheckerRepair301Test extends KernelTestBase {
// Put link inside href attribute to be sure that it was replaced
// without errors.
$this->assertFalse(strpos($body, 'href="/internal"'));
$this->assertTrue(strpos($body, 'href="/replaced"'));
$this->assertNotFalse(strpos($body, 'href="/replaced"'));
}
/**
......
......@@ -32,7 +32,7 @@ class LinkcheckerUnpublish404Test extends KernelTestBase {
'text',
'dynamic_entity_reference',
'linkchecker',
'path',
'path_alias',
];
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment