diff --git a/src/Cli/AcquiaCli.php b/src/Cli/AcquiaCli.php index 91cdb01..be91f89 100644 --- a/src/Cli/AcquiaCli.php +++ b/src/Cli/AcquiaCli.php @@ -42,9 +42,6 @@ public function __construct( InputInterface $input = null, OutputInterface $output = null ) { - if (!file_exists(dirname(dirname(__DIR__)) . '/VERSION')) { - throw new \Exception('No blah file'); - } if ($file = file_get_contents(dirname(dirname(__DIR__)) . '/VERSION')) { $version = trim($file); } else { diff --git a/src/Cli/CloudApi.php b/src/Cli/CloudApi.php index 4c254bd..ce29011 100644 --- a/src/Cli/CloudApi.php +++ b/src/Cli/CloudApi.php @@ -84,7 +84,7 @@ public function getEnvironment($uuid, $environment) } } - throw new \Exception('Unable to find ID for environment'); + throw new \Exception('Unable to find environment from environment name'); } /** @@ -103,7 +103,7 @@ public function getOrganization($organizationName) } } - throw new \Exception('Unable to find ID for organization'); + throw new \Exception('Unable to find organization from organization name'); } public function getClient() diff --git a/tests/AcquiaCliApplicationTest.php b/tests/AcquiaCliApplicationTest.php index 8b8d97a..f005c09 100644 --- a/tests/AcquiaCliApplicationTest.php +++ b/tests/AcquiaCliApplicationTest.php @@ -4,6 +4,7 @@ use AcquiaCli\Tests\AcquiaCliTestCase; use AcquiaCli\Cli\Config; +use AcquiaCli\Cli\CloudApi; class AcquiaCliApplicationTest extends AcquiaCliTestCase { @@ -45,4 +46,42 @@ public function testVersion() $this->assertSame('AcquiaCli 2.0.0-dev' . PHP_EOL, $actualValue); } + + public function testCloudApi() + { + + $config = new Config($this->root); + $cloudApi = new CloudApi($config, $this->client); + + $applicationUuid = $cloudApi->getApplicationUuid('devcloud:devcloud2'); + $this->assertSame('a47ac10b-58cc-4372-a567-0e02b2c3d470', $applicationUuid); + + try { + $applicationError = $cloudApi->getApplicationUuid('devcloud:foobar'); + } catch (\Exception $e) { + $this->assertSame('Unable to find UUID for application', $e->getMessage()); + } + + $environment = $cloudApi->getEnvironment('uuid', 'dev'); + $this->assertInstanceOf('\AcquiaCloudApi\Response\EnvironmentResponse', $environment); + $this->assertSame('24-a47ac10b-58cc-4372-a567-0e02b2c3d470', $environment->uuid); + $this->assertSame('dev', $environment->name); + $this->assertSame('Dev', $environment->label); + $this->assertSame('us-east-1', $environment->region); + $this->assertSame('normal', $environment->status); + + try { + $environmentError = $cloudApi->getEnvironment('uuid', 'foobar'); + } catch (\Exception $e) { + $this->assertSame('Unable to find environment from environment name', $e->getMessage()); + } + + + $command = ['organization:members', 'foobar']; + $organizationError = $this->execute($command); + $this->assertSame( + ' [error] Unable to find organization from organization name ' . PHP_EOL, + $organizationError + ); + } } diff --git a/tests/Cli/AcquiaCliTest.php b/tests/Cli/AcquiaCliTest.php deleted file mode 100644 index 7759533..0000000 --- a/tests/Cli/AcquiaCliTest.php +++ /dev/null @@ -1,45 +0,0 @@ -add('client', $client); - - $container->add('cloudApi', CloudApi::class) - ->withArgument('config') - ->withArgument('client'); - - return $container; - } -} diff --git a/tests/Commands/DeployCommandTest.php b/tests/Commands/DeployCommandTest.php index 7a96d99..b3cefe4 100644 --- a/tests/Commands/DeployCommandTest.php +++ b/tests/Commands/DeployCommandTest.php @@ -35,6 +35,10 @@ public function deployProvider() > Copying files from Production to Stage INFO; + $deployResponseProd = <<