Skip to content
Snippets Groups Projects
Commit 56e96163 authored by Oleksandr MYRHOROD's avatar Oleksandr MYRHOROD Committed by Florian Weber
Browse files

Issue #3429924 by olmyr, webflo: Automated Drupal 11 compatibility fixes for domain_path_redirect

parent 2506debc
No related branches found
No related tags found
1 merge request!9Issue #3429924 by olmyr: Automated Drupal 11 compatibility fixes for domain_path_redirect
Pipeline #598196 canceled
name: 'Domain Path Redirect'
type: module
description: 'Allows users to create redirects per domain'
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^8 || ^9 || ^10 || ^11
dependencies:
- domain:domain
- redirect:redirect
......@@ -10,6 +10,8 @@ use Drupal\domain_path_redirect\Entity\DomainPathRedirect;
use Drupal\redirect\Exception\RedirectLoopException;
use Symfony\Component\HttpFoundation\RequestStack;
// cspell:ignore querystrings
/**
* Loads redirects records.
*/
......@@ -200,12 +202,12 @@ class DomainPathRedirectRepository {
* Loads multiple redirect entities.
*
* @param array $redirect_ids
* Redirect ids to load.
* (optional) Redirect ids to load.
*
* @return \Drupal\domain_path_redirect\Entity\DomainPathRedirect[]
* List of redirect entities.
*/
public function loadMultiple(array $redirect_ids = NULL) {
public function loadMultiple(?array $redirect_ids = NULL) {
return $this->entityTypeManager->getStorage('domain_path_redirect')->loadMultiple($redirect_ids);
}
......
......@@ -12,6 +12,8 @@ use Drupal\Core\Url;
use Drupal\domain_path_redirect\Entity\DomainPathRedirect;
use Symfony\Component\DependencyInjection\ContainerInterface;
// cspell:ignore autocompleteclose
/**
* Provides the redirect create/edit form.
*/
......
......@@ -5,10 +5,10 @@ declare(strict_types=1);
namespace Drupal\Tests\domain_path_redirect\Kernel;
use Drupal\Core\Language\Language;
use Drupal\domain_path_redirect\Entity\DomainPathRedirect;
use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\domain\Traits\DomainTestTrait;
use Drupal\domain_path_redirect\Entity\DomainPathRedirect;
use Drupal\language\Entity\ConfigurableLanguage;
/**
* Redirect entity and redirect API test coverage.
......@@ -70,6 +70,7 @@ class DomainPathRedirectAPITest extends KernelTestBase {
$this->installEntitySchema('redirect');
$this->installEntitySchema('domain_path_redirect');
$this->installEntitySchema('user');
$this->installEntitySchema('path_alias');
$language = ConfigurableLanguage::createFromLangcode('de');
$language->save();
......
......@@ -5,10 +5,10 @@ declare(strict_types=1);
namespace Drupal\Tests\domain_path_redirect\Unit;
use Drupal\Core\Language\Language;
use Drupal\Tests\UnitTestCase;
use Drupal\domain\DomainInterface;
use Drupal\domain_path_redirect\Entity\DomainPathRedirect;
use Drupal\domain_path_redirect\EventSubscriber\DomainPathRedirectRequestSubscriber;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
......@@ -169,10 +169,10 @@ class DomainPathRedirectRequestSubscriberTest extends UnitTestCase {
$redirect->expects($this->once())
->method('getRedirectUrl')
->will($this->returnValue($url));
->willReturn($url);
$redirect->expects($this->any())
->method('getStatusCode')
->will($this->returnValue($status_code));
->willReturn($status_code);
$redirect->expects($this->any())
->method('id')
->willReturn(1);
......@@ -210,7 +210,7 @@ class DomainPathRedirectRequestSubscriberTest extends UnitTestCase {
$checker = $this->createMock('Drupal\redirect\RedirectChecker');
$checker->expects($this->any())
->method('canRedirect')
->will($this->returnValue(TRUE));
->willReturn(TRUE);
$context = $this->createMock('Symfony\Component\Routing\RequestContext');
......@@ -218,7 +218,7 @@ class DomainPathRedirectRequestSubscriberTest extends UnitTestCase {
$inbound_path_processor->expects($this->any())
->method('processInbound')
->with($request->getPathInfo(), $request)
->will($this->returnValue($request->getPathInfo()));
->willReturn($request->getPathInfo());
$alias_manager = $this->createMock('Drupal\path_alias\AliasManagerInterface');
$module_handler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface');
......@@ -266,7 +266,7 @@ class DomainPathRedirectRequestSubscriberTest extends UnitTestCase {
$domain_negotiator->expects($this->any())
->method($method)
->will($this->returnValue($domain));
->willReturn($domain);
return $domain_negotiator;
}
......@@ -287,7 +287,7 @@ class DomainPathRedirectRequestSubscriberTest extends UnitTestCase {
$repository->expects($this->any())
->method($method)
->will($this->returnValue($redirect));
->willReturn($redirect);
return $repository;
}
......@@ -338,7 +338,7 @@ class DomainPathRedirectRequestSubscriberTest extends UnitTestCase {
$language_manager = $this->createMock('Drupal\language\ConfigurableLanguageManagerInterface');
$language_manager->expects($this->any())
->method('getCurrentLanguage')
->will($this->returnValue(new Language(['id' => 'en'])));
->willReturn(new Language(['id' => 'en']));
return $language_manager;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment