/** * @test */ public function findLaunchConfigurationsGroupedByImageIdReturnsExpectedArray() { $autoScalingClient = $this->getAutoScalingGroupClientMock(['describeLaunchConfigurations']); $autoScalingClient->method('describeLaunchConfigurations')->willReturn(new \Aws\Result(['LaunchConfigurations' => [['LaunchConfigurationName' => 'TestLaunchConfiguration', 'ImageId' => 'x1234'], ['LaunchConfigurationName' => 'TestLaunchConfiguration2', 'ImageId' => 'y8765']]])); $profileManager = $this->getProfileManagerMock(['getClient']); $profileManager->method('getClient')->willReturn($autoScalingClient); $autoScalingRepository = new \AwsInspector\Model\AutoScaling\Repository('', $profileManager); $result = $autoScalingRepository->findLaunchConfigurationsGroupedByImageId(); $this->assertArrayHasKey('x1234', $result); $this->assertArrayHasKey('y8765', $result); $this->assertSame(2, count($result)); }
<?php $type = $argv[1]; if ($type != 'Blue' && $type != 'Green') { throw new \InvalidArgumentException('Invalid type'); } require_once __DIR__ . '/../../../../vendor/autoload.php'; $asgRepository = new \AwsInspector\Model\AutoScaling\Repository(); $asg = $asgRepository->findByAutoScalingGroupName('/^test-green-blue-Asg' . $type . '.*/')->getFirst(); /* @var $asg \AwsInspector\Model\AutoScaling\AutoScalingGroup */ $elbRepository = new \AwsInspector\Model\Elb\Repository(); $elb = $elbRepository->findElbByName('test-elb'); var_dump($asg->getLoadBalancerNames()); var_dump($asg->getAutoScalingGroupName()); // $res = $asg->attachLoadBalancers([$elb]); //var_dump($res);