izzum\statemachine\TransitionTest::shouldBeAbleToCopy PHP Method

shouldBeAbleToCopy() public method

public shouldBeAbleToCopy ( )
    public function shouldBeAbleToCopy()
    {
        $a = new State('a');
        $b = new State('b');
        $a_copy = new State('a');
        $b_copy = new State('b');
        $event = 'my-event';
        $rule = 'foo-rule';
        $command = 'foo-command';
        $description = 'foobar';
        $gc = function () {
            echo "guard callable";
            return true;
        };
        $tc = function () {
            echo "transition callable";
        };
        $t = new Transition($a, $b, $event, $rule, $command, $gc, $tc);
        $t->setDescription($description);
        $copy = $t->getCopy($a_copy, $b_copy);
        $this->assertNotSame($a, $a_copy);
        $this->assertNotSame($b, $b_copy);
        $this->assertNotSame($copy, $t);
        $this->assertEquals($description, $copy->getDescription());
        $this->assertEquals($rule, $copy->getRuleName());
        $this->assertEquals($command, $copy->getCommandName());
        $this->assertEquals($event, $copy->getEvent());
        $this->assertEquals($t->getName(), $copy->getName());
        $this->assertEquals($t->getGuardCallable(), $copy->getGuardCallable());
        $this->assertEquals($gc, $copy->getGuardCallable());
        $this->assertEquals($tc, $copy->getTransitionCallable());
    }