public function execute(InputInterface $input, OutputInterface $output)
 {
     $generator = new EndpointGenerator($input, $output, new QuestionHelper());
     $generator->setDelete($input->getOption("delete"));
     $generator->setForce($input->getOption("force"));
     if ($endpoint = $input->getArgument('endpoint')) {
         $output->writeln("Generating endpoint wrapper for: " . $endpoint);
         $generator->generateForEndpoint($endpoint);
         return true;
     }
     $generator->generateAllEndpoints();
     return true;
 }
 public function testClassesInGivenNameSpaceRootAreAddedAsMethods()
 {
     $client = Mockery::mock(ClientInterface::class);
     $out = Mockery::mock(OutputInterface::class);
     $out->shouldReceive("write");
     $out->shouldReceive("writeln")->times(12);
     $inMock = Mockery::mock(InputInterface::class);
     $dialog = Mockery::mock(QuestionHelper::class);
     $dialog->shouldReceive("ask")->andReturn(true);
     $generator = new EndpointGenerator($inMock, $out, $dialog);
     $generator->generateForEndpoint("Episodes");
     $content = $this->filesystem->read("Episodes.php");
     $this->assertContains('public function comments', $content);
     $this->assertContains('public function ratings', $content);
     $this->assertContains('public function stats', $content);
     $this->assertContains('public function summary', $content);
     $this->assertContains('public function get', $content);
     $this->assertContains('public function watching', $content);
 }
 /**
  * @skip
  */
 public function testAddsDefaultValueToParametersWithDefaultValue()
 {
     $outMock = Mockery::mock(OutputInterface::class);
     $outMock->shouldReceive("writeln");
     $outMock->shouldReceive("write");
     $inMock = Mockery::mock(InputInterface::class);
     $dialog = Mockery::mock(QuestionHelper::class);
     $dialog->shouldReceive("ask")->andReturn(true);
     $generator = new EndpointGenerator($inMock, $outMock, $dialog);
     $generator->generateForEndpoint("Search");
     $content = $generator->getGeneratedTemplate();
     $this->assertContains('public function byText($query, $type = null, $year = null, AccessToken $token = null)', $content);
 }
 /**
  * @param $properties
  * @param $content
  */
 private function handleDirectory(Collection $properties, $content)
 {
     $properties->push($content['filename']);
     $this->filesystem->createDir('Api/' . $this->endpoint->first());
     $generator = new EndpointGenerator($this->inputInterface, $this->out, $this->dialogHelper);
     $endpoint = str_replace("Request/", "", $content['path']);
     $generator->generateForEndpoint($endpoint);
 }