/** * @param array $cliArguments * @param \SplFileObject $outputStream * * @return void */ public function handleInput(array $cliArguments, \SplFileObject $outputStream) { $this->interfaceDistiller->saveAs($outputStream); $unappliedOptions = $this->applyOptions($cliArguments); if (count($unappliedOptions) === 2) { $this->interfaceDistiller->distill($unappliedOptions[0], $unappliedOptions[1]); $outputStream->fwrite(PHP_EOL . 'Done.' . PHP_EOL); } else { $outputStream->fwrite($this->getUsage() . PHP_EOL); } }
/** * @return void */ public function testDistillUsingMethodModifiersOption() { $this->interfaceDistiller->methodsWithModifiers(\ReflectionMethod::IS_STATIC)->distill('\\com\\github\\gooh\\InterfaceDistiller\\DistillTestClass', 'DistillWithStaticMethodsOnly'); $this->assertWrittenInterfaceEqualsExpectedFile('distillWithStaticMethodsOnly.php'); }
/** * @covers \com\github\gooh\InterfaceDistiller\Controller\CommandLine::handleInput */ public function testControllerWritesInterfaceToOutputStreamWhenSaveAsOptionIsNotGiven() { $outStream = new \SplTempFileObject(-1); $this->distillerMock->expects($this->once())->method('saveAs')->with($outStream); call_user_func($this->commandLineController, array('scriptname', 'SomeClass', 'SomeInterface'), $outStream); }