Scalr\Tests\Service\Aws\ElbTest::testDescribeLoadBalancers PHP Метод

testDescribeLoadBalancers() публичный Метод

    public function testDescribeLoadBalancers()
    {
        $this->skipIfEc2PlatformDisabled();
        $list = $this->elb->loadBalancer->describe(array(self::getTestName(self::LB_NAME_FUNC_TEST_1), self::getTestName(self::LB_NAME_FUNC_TEST_2)));
        $this->assertInstanceOf('Scalr\\Service\\Aws\\Elb\\DataType\\LoadBalancerDescriptionList', $list, 'describeLoadBalancers() result must be instance of LoadBalancerDescriptionList');
        $this->assertEquals(2, count($list));
        try {
            $this->elb->loadBalancer->describe('unknown-load-balancer-name');
            $this->assertTrue(false, 'QueryClientException must be thrown here!');
        } catch (QueryClientException $e) {
            $this->assertInstanceOf(self::CLASS_ERROR_DATA, $e->getErrorData());
            $this->assertEquals(ErrorData::ERR_LOAD_BALANCER_NOT_FOUND, $e->getErrorData()->getCode());
        }
        $em = $this->elb->getEntityManager();
        $repository = $em->getRepository('Elb:LoadBalancerDescription');
        /* @var $one LoadBalancerDescriptionData */
        $one = $repository->find(self::getTestName(self::LB_NAME_FUNC_TEST_1));
        $this->assertInstanceOf(self::CLASS_LOAD_BALANCER_DESCRIPTION_DATA, $one);
        $this->assertEquals(self::getTestName(self::LB_NAME_FUNC_TEST_1), $one->loadBalancerName, 'Load Balancer name does not match.');
        try {
            $one->applySecurityGroups(array('sg-1'));
            $this->assertTrue(false, 'QueryClientException must be thrown here.');
        } catch (QueryClientException $e) {
            $this->assertEquals(ErrorData::ERR_INVALID_CONFIGURATION_REQUEST, $e->getErrorData()->getCode());
        }
        $two = $repository->find(self::getTestName(self::LB_NAME_FUNC_TEST_2));
        $this->assertInstanceOf(self::CLASS_LOAD_BALANCER_DESCRIPTION_DATA, $two);
        $this->assertEquals(self::getTestName(self::LB_NAME_FUNC_TEST_2), $two->loadBalancerName, 'Load Balancer name does not match.');
    }