izzum\statemachine\Transition::setDescription PHP Method

setDescription() public method

set the description of the transition (for uml generation for example)
public setDescription ( string $description )
$description string
    public function setDescription($description)
    {
        $this->description = $description;
        return $this;
    }

Usage Example

 /**
  * @test
  */
 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());
 }
All Usage Examples Of izzum\statemachine\Transition::setDescription