Example #1
0
 /**
  * @test
  */
 public function testPhotoSortRename()
 {
     $this->copyFixturesIntoDir($this->fooDir);
     $photoSort = new PhotoSort();
     $photoSort->rename($this->fooDir);
     $this->assertFileExists($this->fooDir . '/2015-03-14 12:57:43.jpg');
 }
Example #2
0
 /**
  * Execute command
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return bool
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $quiet = $output->getVerbosity() == OutputInterface::VERBOSITY_QUIET;
     $verbose = $output->getVerbosity() == OutputInterface::VERBOSITY_VERBOSE;
     if (!$quiet) {
         $output->write('<info>' . $this->getApplication()->getName() . '</info>');
         $output->write(' version <comment>' . $this->getApplication()->getVersion() . '</comment> ');
         $output->writeln("by J.Ginés Hernández G. <*****@*****.**>\n");
     }
     $sourcePath = $input->getArgument('source');
     $destPath = $input->getArgument('dest');
     $formatType = $input->getOption('format');
     $sortImg = new PhotoSort($verbose);
     $items = $sortImg->copy($sourcePath, $destPath, $formatType);
     if ($verbose) {
         if (count($items)) {
             $table = new Table($output);
             $table->setHeaders(array('Old File', 'New File'));
             $table->setRows($items);
             $table->render();
         }
         $output->writeln("\nCheers!\n");
     }
     return true;
 }