Esempio n. 1
0
 /**
  * @test
  */
 public function shouldFlushRepositories()
 {
     $file = $this->createJsonFileMock();
     $config = new Config($file);
     $repository = new Repository();
     $repository->setUrl('myurl');
     $repository->setType('composer');
     $config->setRepositories([$repository]);
     $file->expects($this->once())->method('write')->with(['repositories' => [['type' => 'composer', 'url' => 'myurl']]]);
     $config->flush();
 }
Esempio n. 2
0
 protected function init()
 {
     $this->data = $this->config->read();
     if (!empty($this->data['repositories'])) {
         foreach ($this->data['repositories'] as $repoData) {
             $repo = new Repository();
             $repo->setUrl($repoData['url']);
             $repo->setType($repoData['type']);
             $this->repositories[] = $repo;
         }
     }
     if (isset($this->data['config']['github-oauth']['github.com'])) {
         $this->oauth = $this->data['config']['github-oauth']['github.com'];
     }
 }
Esempio n. 3
0
 /**
  * @test
  */
 public function shouldReturnTypeThatWasSetBefore()
 {
     $repo = new Repository();
     $repo->setType($type = 'vcs');
     $this->assertEquals($type, $repo->getType());
 }