Пример #1
0
 /**
  * @covers ::set
  * @covers ::get
  */
 public function testSetGet()
 {
     $file = __DIR__ . '/composer-token-test';
     if (file_exists($file)) {
         unlink($file);
     }
     $token = new Token($file);
     $this->assertSame(null, $token->get(), 'Should return null if no token file');
     $token->set('TEST_TOKEN');
     $this->assertEquals('TEST_TOKEN', file_get_contents($file), 'Token file should be created');
     $otherToken = new Token($file);
     $this->assertEquals('TEST_TOKEN', $otherToken->get(), 'Token should be read by file');
     unlink($file);
 }
Пример #2
0
 /**
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $token = $input->getArgument('token');
     $this->token->set($token);
     $output->writeln("Token saved to {$this->token->getFilename()}");
 }