CommandTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * This file is part of the DigitalOcean library.
  4. *
  5. * (c) Antoine Corcy <contact@sbin.dk>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace DigitalOcean\Tests\CLI;
  11. use Symfony\Component\Console\Application;
  12. use Symfony\Component\Console\Tester\CommandTester;
  13. use DigitalOcean\Tests\TestCase;
  14. use DigitalOcean\CLI\Command;
  15. /**
  16. * @author Antoine Corcy <contact@sbin.dk>
  17. */
  18. class CommandTest extends TestCase
  19. {
  20. protected $distFile;
  21. protected $command;
  22. protected function setUp()
  23. {
  24. $this->distFile = 'credentials.yml.dist';
  25. $this->command = new Command('foo');
  26. }
  27. public function testGetDigitalOcean()
  28. {
  29. $digitalOcean = $this->command->getDigitalOcean($this->distFile);
  30. $this->assertTrue(is_object($digitalOcean));
  31. $this->assertInstanceOf('\\DigitalOcean\\DigitalOcean', $digitalOcean);
  32. }
  33. /**
  34. * @expectedException \RuntimeException
  35. * @expectedExceptionMessage Impossible to get credentials informations in ./foo/bar
  36. */
  37. public function testGetDigitalOceanThrowsRuntimeException()
  38. {
  39. $this->command->getDigitalOcean('./foo/bar');
  40. }
  41. }