getMockBuilder(PluginInterface::class)->onlyMethods(['getName', 'getPath'])->getMock(); $plugin1->expects($this->any())->method('getName')->willReturn('TestBundle'); $plugin1->expects($this->exactly(2))->method('getPath')->willReturn(__DIR__ . '/../Plugin/Fixtures/TestPlugin'); $commandTester = $this->getCommandTester([$plugin1], []); $output = $commandTester->getDisplay(); $this->assertStringContainsString(__DIR__, $output); $this->assertStringContainsString('Plugin/Fixtures/TestPlugin', $output); $this->assertStringContainsString('TestPlugin from composer.json', $output); } private function getCommandTester(array $plugins, array $options = []): CommandTester { $kernel = self::bootKernel(); $this->application = new Application($kernel); $this->application->add(new PluginCommand(new PluginManager($plugins))); $command = $this->application->find('kimai:plugins'); $commandTester = new CommandTester($command); $inputs = array_merge(['command' => $command->getName()], $options); $commandTester->execute($inputs); return $commandTester; } }