izzum\statemachine\utils\UtilsTest::shouldGetCommandWithEntity PHP Method

shouldGetCommandWithEntity() public method

    public function shouldGetCommandWithEntity()
    {
        $command_name = 'izzum\\statemachine\\utils\\IncreaseId';
        $entity = new \stdClass();
        $entity->id = 0;
        $entity->event = null;
        //modelbuilder always returns the model we give it in the constructor
        $context = new Context(new Identifier('1', 'test'), new ModelBuilder($entity));
        $event = null;
        $command = Utils::getCommand($command_name, $context);
        $this->assertTrue(is_a($command, 'izzum\\command\\Composite'));
        $this->assertContains('IncreaseId', $command->toString());
        $this->assertEquals(0, $entity->id);
        $command->execute();
        $this->assertEquals(1, $entity->id);
    }