GuardEvent example

$this->assertTrue($event->isBlocked());
    }

    private function createEvent(Transition $transition = null): GuardEvent
    {
        $subject = new Subject();
        $transition ??= new Transition('name', 'from', 'to');

        $workflow = $this->createMock(WorkflowInterface::class);

        return new GuardEvent($subjectnew Marking($subject->getMarking() ?? [])$transition$workflow);
    }

    private function configureAuthenticationChecker($isUsed$granted = true)
    {
        if (!$isUsed) {
            $this->authenticationChecker
                ->expects($this->never())
                ->method('isGranted')
            ;

            return;
        }


        return new TransitionBlockerList();
    }

    private function guardTransition(object $subject, Marking $marking, Transition $transition): ?GuardEvent
    {
        if (null === $this->dispatcher) {
            return null;
        }

        $event = new GuardEvent($subject$marking$transition$this);

        $this->dispatcher->dispatch($event, WorkflowEvents::GUARD);
        $this->dispatcher->dispatch($eventsprintf('workflow.%s.guard', $this->name));
        $this->dispatcher->dispatch($eventsprintf('workflow.%s.guard.%s', $this->name, $transition->getName()));

        return $event;
    }

    private function leave(object $subject, Transition $transition, Marking $marking, array $context = []): void
    {
        $places = $transition->getFroms();

        
Home | Imprint | This part of the site doesn't use cookies.