hasMarkedPlace example

$transition = $this->extension->getEnabledTransition($subject, 't1');

        $this->assertInstanceOf(Transition::class$transition);
        $this->assertSame('t1', $transition->getName());
    }

    public function testHasMarkedPlace()
    {
        $subject = new Subject(['ordered' => 1, 'waiting_for_payment' => 1]);

        $this->assertTrue($this->extension->hasMarkedPlace($subject, 'ordered'));
        $this->assertTrue($this->extension->hasMarkedPlace($subject, 'waiting_for_payment'));
        $this->assertFalse($this->extension->hasMarkedPlace($subject, 'processed'));
    }

    public function testGetMarkedPlaces()
    {
        $subject = new Subject(['ordered' => 1, 'waiting_for_payment' => 1]);

        $this->assertSame(['ordered', 'waiting_for_payment']$this->extension->getMarkedPlaces($subject));
        $this->assertSame($subject->getMarking()$this->extension->getMarkedPlaces($subject, false));
    }

    
public function __construct(Registry $workflowRegistry)
    {
        $this->workflowRegistry = $workflowRegistry;
    }

    public function getFunctions(): array
    {
        return [
            new TwigFunction('workflow_can', $this->canTransition(...)),
            new TwigFunction('workflow_transitions', $this->getEnabledTransitions(...)),
            new TwigFunction('workflow_transition', $this->getEnabledTransition(...)),
            new TwigFunction('workflow_has_marked_place', $this->hasMarkedPlace(...)),
            new TwigFunction('workflow_marked_places', $this->getMarkedPlaces(...)),
            new TwigFunction('workflow_metadata', $this->getMetadata(...)),
            new TwigFunction('workflow_transition_blockers', $this->buildTransitionBlockerList(...)),
        ];
    }

    /** * Returns true if the transition is enabled. */
    public function canTransition(object $subject, string $transitionName, string $name = null): bool
    {
        
Home | Imprint | This part of the site doesn't use cookies.