/** * Logging info about chain, master command and anoncing start of his execution. * * @param ConsoleChainEvent $event */ public function onConsoleChainCommand(ConsoleChainEvent $event) { $commandName = $event->getCommand()->getName(); $this->logger->log(200, sprintf('%s is a master command of a command chain that has registered member commands', $commandName)); foreach ($event->getChainMembers() as $member => $parentCommand) { $this->logger->log(200, sprintf('%s registered as a member of %s command chain', $member, $parentCommand)); } $this->logger->log(200, sprintf('Executing %s command itself first:', $commandName)); }
/** * Test for requesting chain members from event. */ public function testGetChainMembers() { $event = new ConsoleChainEvent(new Command('bar:main'), new ArrayInput([]), new ConsoleOutput(), ['foo:second' => 'bar:main']); static::assertEquals(['foo:second' => 'bar:main'], $event->getChainMembers()); }