Skip to content
Snippets Groups Projects
Commit ebb981d4 authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

Issue #3297872 by claudiu.cristea, Project Update Bot: Automated Drupal 10 compatibility fixes

parent 19312fc7
Branches
Tags 8.x-1.0-alpha4
1 merge request!5Resolve #3297872 "D10"
type: module
name: Pipeline
description: 'Allows splitting processes in steps and then running them via an orchestrator service.'
core_version_requirement: ^8.9 || ^9.1
core_version_requirement: ^8.9 || ^9.1 || ^10
......@@ -4,8 +4,8 @@ declare(strict_types = 1);
namespace Drupal\pipeline\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Drupal\pipeline\Plugin\PipelinePipelineInterface;
use Symfony\Component\EventDispatcher\Event;
/**
* A failed pipeline completion event.
......
......@@ -4,8 +4,8 @@ declare(strict_types = 1);
namespace Drupal\pipeline\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Drupal\pipeline\Plugin\PipelinePipelineInterface;
use Symfony\Component\EventDispatcher\Event;
/**
* A successful pipeline completion event.
......
......@@ -125,7 +125,7 @@ abstract class PipelinePipelinePluginBase extends PluginBase implements Pipeline
}
$event = new PipelineSuccessEvent($this);
$this->eventDispatcher->dispatch(PipelineSuccessEvent::class, $event);
$this->eventDispatcher->dispatch($event);
// Reset the state manager.
$this->stateManager->reset($this->getPluginId());
......@@ -154,7 +154,7 @@ abstract class PipelinePipelinePluginBase extends PluginBase implements Pipeline
}
$event = new PipelineErrorEvent($this);
$this->eventDispatcher->dispatch(PipelineErrorEvent::class, $event);
$this->eventDispatcher->dispatch($event);
// Reset the state manager.
$this->stateManager->reset($this->getPluginId());
......@@ -196,20 +196,21 @@ abstract class PipelinePipelinePluginBase extends PluginBase implements Pipeline
/**
* {@inheritdoc}
*/
public function next() {
public function next(): void {
$this->getStepList()->next();
}
/**
* {@inheritdoc}
*/
public function valid() {
public function valid(): bool {
return $this->getStepList()->valid();
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function current() {
return $this->getStepList()->current();
}
......@@ -217,13 +218,14 @@ abstract class PipelinePipelinePluginBase extends PluginBase implements Pipeline
/**
* {@inheritdoc}
*/
public function rewind() {
public function rewind(): void {
$this->getStepList()->rewind();
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function key() {
return $this->getStepList()->key();
}
......
......@@ -7,6 +7,8 @@
namespace Drupal\Tests\pipeline\Unit;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Form\FormBuilder;
use Drupal\Core\Messenger\Messenger;
......@@ -22,6 +24,7 @@ use Drupal\pipeline\Plugin\PipelineStepPluginManager;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Tests the data pipeline processor.
......@@ -32,6 +35,8 @@ use Symfony\Component\HttpFoundation\RequestStack;
*/
class PipelineOrchestratorTest extends UnitTestCase {
use ProphecyTrait;
/**
* The data pipeline plugin manager.
*
......@@ -98,7 +103,7 @@ class PipelineOrchestratorTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->pipelinePluginManager = $this->prophesize(PipelinePipelinePluginManager::class);
$this->stepPluginManager = $this->prophesize(PipelineStepPluginManager::class);
......@@ -109,6 +114,8 @@ class PipelineOrchestratorTest extends UnitTestCase {
$this->requestStack = $this->prophesize(RequestStack::class);
$this->renderer = $this->prophesize(Renderer::class);
$this->eventDispatcher = $this->prophesize(EventDispatcherInterface::class);
$this->eventDispatcher->dispatch(Argument::type(Event::class))
->willReturnArgument();
}
/**
......@@ -160,8 +167,7 @@ class PipelineOrchestratorTest extends UnitTestCase {
$this->formBuilder->reveal(),
$this->messenger->reveal(),
$this->currentUser->reveal(),
$this->requestStack->reveal(),
$this->renderer->reveal(),
$this->requestStack->reveal()
))->run('demo_pipe');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment