コード例 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('');
     $output->writeln('-----------STARTING------------');
     $output->writeln('');
     $url = $input->getArgument('url');
     $client = new Client();
     $scraper = new Scraper($client);
     $result = $scraper->getJson($url);
     $output->writeln('');
     $output->writeln('');
     if ($result) {
         $output->writeln($result);
     } else {
         $output->writeln('Oops: something went wrong :(');
     }
     $output->writeln('');
     $output->writeln('-----------FINISHED------------');
     $output->writeln('');
 }
コード例 #2
0
 public function testFormatBytesAgain()
 {
     $client = new Client();
     $client = new Scraper($client);
     $expected = '1000.49kb';
     $actual = $client->formatBytes(1024500);
     $this->assertEquals($expected, $actual);
 }