Commit 5a0fbba1 authored by voleger's avatar voleger
Browse files

Issue #3224012 by voleger, linichalexey, kyberman: Fix Drupal 9 error

parent 683d0d39
......@@ -2,4 +2,4 @@ name: Queue Order
type: module
description: Provide basic functionality to control queue order execution
package: Queues
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
......@@ -11,6 +11,8 @@ use Drupal\Core\Queue\QueueWorkerManager as CoreQueueWorkerManager;
/**
* Class QueueWorkerManager.
*
* Plugin manager extention class.
*
* @package Drupal\queue_order\Queue
*/
class QueueWorkerManager extends CoreQueueWorkerManager {
......
......@@ -10,6 +10,9 @@ use Symfony\Component\DependencyInjection\Reference;
/**
* Class QueueOrderServiceProvider.
*
* Alter of the service definition to extend Drupal core
* queue_worker plugin manager functionality.
*
* @package Drupal\queue_order
*/
class QueueOrderServiceProvider extends ServiceProviderBase {
......
......@@ -2,6 +2,5 @@ name: Queue Order Definitions Test
type: module
description: 'Provides testing definitions for Queue Order module'
package: Testing
core_version_requirement: ^8.8 || ^9.0
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
......@@ -5,6 +5,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
/**
* Class WorkerA.
*
* Worker definition for testing purposes.
*
* @package Drupal\queue_order_definition_fixtures\Plugin\QueueWorker
*
* @QueueWorker(
......
......@@ -5,6 +5,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
/**
* Class WorkerB.
*
* Worker definition for testing purposes.
*
* @package Drupal\queue_order_definition_fixtures\Plugin\QueueWorker
*
* @QueueWorker(
......
......@@ -5,6 +5,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
/**
* Class WorkerC.
*
* Worker definition for testing purposes.
*
* @package Drupal\queue_order_definition_fixtures\Plugin\QueueWorker
*
* @QueueWorker(
......
......@@ -5,6 +5,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
/**
* Class WorkerD.
*
* Worker definition for testing purposes.
*
* @package Drupal\queue_order_definition_fixtures\Plugin\QueueWorker
*
* @QueueWorker(
......
......@@ -5,6 +5,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
/**
* Class WorkerE.
*
* Worker definition for testing purposes.
*
* @package Drupal\queue_order_definition_fixtures\Plugin\QueueWorker
*
* @QueueWorker(
......
......@@ -5,6 +5,8 @@ namespace Drupal\queue_order_definition_fixtures\Plugin\QueueWorker;
/**
* Class WorkerF.
*
* Worker definition for testing purposes.
*
* @package Drupal\queue_order_definition_fixtures\Plugin\QueueWorker
*
* @QueueWorker(
......
name: Queue Order Definitions Test
name: Queue Order Definitions Override Test
type: module
description: 'Provides testing definitions for Queue Order module'
description: Provides testing override definitions for Queue Order module
package: Testing
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
dependencies:
- queue_order:queue_order_definition_fixtures
......@@ -13,6 +13,9 @@ use Drupal\Tests\BrowserTestBase;
*/
class DefinitionsWithOverridesTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
......@@ -28,8 +31,13 @@ class DefinitionsWithOverridesTest extends BrowserTestBase {
*
* @var \Drupal\Core\Queue\QueueWorkerManagerInterface
*/
protected $QueueWorkerManager;
protected $queueWorkerManager;
/**
* Expected order list.
*
* @var string[]
*/
protected $orderedList = [
'queue_order_worker_F',
'queue_order_worker_E',
......@@ -42,9 +50,9 @@ class DefinitionsWithOverridesTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->QueueWorkerManager = $this->container->get('plugin.manager.queue_worker');
$this->queueWorkerManager = \Drupal::service('plugin.manager.queue_worker');
}
/**
......@@ -53,12 +61,12 @@ class DefinitionsWithOverridesTest extends BrowserTestBase {
public function testOrder() {
$this->assertEquals(
$this->orderedList,
array_keys($this->QueueWorkerManager->getDefinitions()),
array_keys($this->queueWorkerManager->getDefinitions()),
'Order is not managed by the config settings'
);
$this->assertSame(
$this->orderedList,
array_keys($this->QueueWorkerManager->getDefinitions()),
array_keys($this->queueWorkerManager->getDefinitions()),
'Order is not managed by the config settings'
);
}
......
......@@ -5,6 +5,8 @@ namespace Drupal\Tests\queue_order\Kernel;
/**
* Class DefinitionsWithModuleTest.
*
* Test module functionality.
*
* @package Drupal\queue_order\Tests\Kernel
*
* @group queue_order
......@@ -22,12 +24,12 @@ class DefinitionsWithModuleTest extends DefinitionsWithoutModuleTest {
public function testOrder() {
$this->assertEquals(
$this->orderedList,
array_keys($this->QueueWorkerManager->getDefinitions()),
array_keys($this->queueWorkerManager->getDefinitions()),
$this > t('Order is managed by the module')
);
$this->assertSame(
$this->orderedList,
array_keys($this->QueueWorkerManager->getDefinitions()),
array_keys($this->queueWorkerManager->getDefinitions()),
$this > t('Order is managed by the module')
);
}
......@@ -36,7 +38,7 @@ class DefinitionsWithModuleTest extends DefinitionsWithoutModuleTest {
* Test is functionality force creation of `cron` key.
*/
public function testCronKeyExistance() {
$definition = $this->QueueWorkerManager
$definition = $this->queueWorkerManager
->getDefinition('queue_order_worker_B');
$this->assertArrayNotHasKey('cron', $definition);
}
......
......@@ -7,6 +7,8 @@ use Drupal\KernelTests\KernelTestBase;
/**
* Class DefinitionsWithoutModuleTest.
*
* Tests comnpatibility with Drupal functionality.
*
* @package Drupal\queue_order\Tests\Kernel
*
* @group queue_order
......@@ -23,8 +25,13 @@ class DefinitionsWithoutModuleTest extends KernelTestBase {
*
* @var \Drupal\Core\Queue\QueueWorkerManagerInterface
*/
protected $QueueWorkerManager;
protected $queueWorkerManager;
/**
* Expected order for tests.
*
* @var string[]
*/
protected $orderedList = [
'queue_order_worker_B',
'queue_order_worker_A',
......@@ -37,9 +44,9 @@ class DefinitionsWithoutModuleTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->QueueWorkerManager = $this->container->get('plugin.manager.queue_worker');
$this->queueWorkerManager = \Drupal::service('plugin.manager.queue_worker');
}
/**
......@@ -48,12 +55,12 @@ class DefinitionsWithoutModuleTest extends KernelTestBase {
public function testOrder() {
$this->assertNotEquals(
$this->orderedList,
array_keys($this->QueueWorkerManager->getDefinitions()),
array_keys($this->queueWorkerManager->getDefinitions()),
$this > t('Order is managed by the core functionality')
);
$this->assertNotSame(
$this->orderedList,
array_keys($this->QueueWorkerManager->getDefinitions()),
array_keys($this->queueWorkerManager->getDefinitions()),
$this > t('Order is managed by the core functionality')
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment