/**
  * @dataProvider remoteClassesProvider
  */
 public function testRemotes($class)
 {
     $guardian = new GitGuardian();
     $this->assertEmpty($guardian->getRemotes());
     $remote = $this->getMockBuilder($class)->disableOriginalConstructor()->getMock();
     $guardian->addRemote($remote);
     $this->assertNotEmpty($guardian->getRemotes());
     $this->assertCount(1, $guardian->getRemotes());
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     if (!in_array($input->getOption('adapter'), ['BitBucket', 'GitHub'])) {
         throw new InvalidArgumentException(sprintf('The given adapter "%s" is not supported (yet)', $input->getOption('adapter')));
     }
     $guardian = new GitGuardian();
     $emitter = $guardian->getEmitter();
     if ('GitHub' === $input->getOption('adapter')) {
         $users = $input->getArgument('owner');
         if (count($users) && !strstr($users[0], '/')) {
             $username = array_shift($users);
             $gitHubCredentials = ['personal_token' => $input->getOption('personal-token'), 'username' => $username];
             $remote = new GitHubRemote();
             $remote->setEmitter($emitter);
             $remote->setOptions($gitHubCredentials);
             $guardian->addRemote($remote);
         }
         foreach ($users as $owner) {
             $remote = new GitHubRemote();
             $remote->setEmitter($emitter);
             $remote->setUser($owner);
             $guardian->addRemote($remote);
         }
     } else {
         $bitBucketCredentials = ['client_id' => $input->getOption('client-id'), 'client_secret' => $input->getOption('client-secret')];
         foreach ($input->getArgument('owner') as $owner) {
             $remote = new BitBucketRemote();
             $remote->setEmitter($emitter);
             $remote->setOptions($bitBucketCredentials);
             $remote->setUser($owner);
             $guardian->addRemote($remote);
         }
     }
     $this->setupListeners($emitter, $output);
     $guardian->cloneAll($input->getOption('destination'));
 }