예제 #1
0
 public function testGettersSetters()
 {
     $callable = function () {
     };
     $definition = new CommandDefinition('animal', ['name'], $callable);
     $this->assertSame($definition->getName(), 'animal');
     $this->assertSame(['name'], $definition->getRequiredArgs());
     $this->assertSame($callable, $definition->getCommandCallable());
 }
 public function testGettersSettersWithObjArgs()
 {
     $callable = function () {
     };
     $definition = new CommandDefinition('animal', [new CommandArgument('name')], $callable);
     $this->assertSame($definition->getName(), 'animal');
     $requiredArgs = $definition->getRequiredArgs();
     $this->assertCount(1, $requiredArgs);
     $this->assertInstanceOf(CommandArgument::class, $requiredArgs[0]);
     $this->assertSame('name', $requiredArgs[0]->getName());
     $this->assertSame($callable, $definition->getCommandCallable());
 }