public function testRunBenchmarks() { $strategy = $this->prophesize("Bench\\IterationStrategy"); $strategy->getIterateCount(Argument::Any(), Argument::Any())->willReturn(10); $extractor = $this->prophesize("Bench\\MethodExtractor"); $extractor->getCallables()->willReturn([["test", function () { }]]); $output = $this->prophesize('Symfony\\Component\\Console\\Output\\OutputInterface'); $output->writeln(Argument::Any())->shouldBeCalledTimes(1); $sut = new BenchRunner($extractor->reveal(), $strategy->reveal(), $output->reveal()); $sut->runBenchmarks(new PrintResult()); }
protected function execute(InputInterface $input, OutputInterface $output) { $paths = $input->getArgument('paths'); $minDuration = $input->getOption("min-duration"); $minTimes = $input->getOption("min-times"); $files = $this->finder->files(); foreach ($paths as $path) { $files->in($path); } $strategy = new IterationStrategy($minDuration, $minTimes); $extractor = new MethodExtractor($this->finder->getIterator()); $benchRunner = new BenchRunner($extractor, $strategy, $output); $benchRunner->runBenchmarks(new PrintResult()); }