Scalr\Tests\Service\Aws\CloudFrontTest::testDescribeDistributions PHP Method

testDescribeDistributions() public method

    public function testDescribeDistributions()
    {
        $cf = $this->getCloudFrontMock($this->getResponseCallback(substr(__FUNCTION__, 4)));
        $list = $cf->distribution->describe();
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\DistributionList'), $list);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $list->getCloudFront());
        $this->assertEquals(1, count($list));
        $this->assertEquals(100, $list->maxItems);
        $this->assertEquals('', $list->marker);
        $this->assertEquals(false, $list->isTruncated);
        /* @var $dist CloudFrontDataType\DistributionData */
        $dist = $list->get(0);
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\DistributionData'), $dist);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $dist->getCloudFront());
        $this->assertEquals('E3F7022YJAMF41', $dist->distributionId);
        $this->assertEquals('Deployed', $dist->status);
        $this->assertEquals('2011-02-22T16:49:06+00:00', $dist->lastModifiedTime->format('c'));
        $this->assertEquals('dvxau28fvexxx.cloudfront.net', $dist->domainName);
        $this->assertEquals(null, $dist->inProgressInvalidationBatches);
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\TrustedSignerList'), $dist->activeTrustedSigners);
        $this->assertEquals(0, count($dist->activeTrustedSigners));
        /* @var $dc CloudFrontDataType\DistributionConfigData */
        $dc = $dist->distributionConfig;
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\DistributionConfigData'), $dc);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $dc->getCloudFront());
        $this->assertEquals($dist->distributionId, $dc->getDistributionId());
        $this->assertEquals(null, $dc->callerReference);
        $this->assertEquals('test', $dc->comment);
        $this->assertEquals(null, $dc->defaultRootObject);
        $this->assertEquals(true, $dc->enabled);
        $this->assertEquals('PriceClass_All', $dc->priceClass);
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\DistributionConfigAliasList'), $dc->aliases);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $dc->aliases->getCloudFront());
        $this->assertEquals($dist->distributionId, $dc->aliases->getDistributionId());
        $this->assertEquals(1, count($dc->aliases));
        $this->assertEquals('test.sdfsdfdsfsdfsd.com', $dc->aliases[0]->cname);
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\CacheBehaviorList'), $dc->cacheBehaviors);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $dc->cacheBehaviors->getCloudFront());
        $this->assertEquals($dist->distributionId, $dc->cacheBehaviors->getDistributionId());
        $this->assertEquals(0, count($dc->cacheBehaviors));
        /* @var $cb CloudFrontDataType\CacheBehaviorData */
        $cb = $dc->defaultCacheBehavior;
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\CacheBehaviorData'), $cb);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $cb->getCloudFront());
        $this->assertEquals($dist->distributionId, $cb->getDistributionId());
        $this->assertEquals('MyOrigin', $cb->targetOriginId);
        $this->assertEquals('allow-all', $cb->viewerProtocolPolicy);
        $this->assertEquals(3600, $cb->minTtl);
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\ForwardedValuesData'), $cb->forwardedValues);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $cb->forwardedValues->getCloudFront());
        $this->assertEquals($dist->distributionId, $cb->forwardedValues->getDistributionId());
        $this->assertEquals(false, $cb->forwardedValues->queryString);
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\ForwardedValuesCookiesData'), $cb->forwardedValues->cookies);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $cb->forwardedValues->cookies->getCloudFront());
        $this->assertEquals($dist->distributionId, $cb->forwardedValues->cookies->getDistributionId());
        /* @var $cook CloudFrontDataType\ForwardedValuesCookiesData */
        $cook = $cb->forwardedValues->cookies;
        $this->assertEquals('none', $cook->forward);
        $this->assertInstanceOf($this->getCloudFrontClassName('DataType\\WhitelistedCookieNamesList'), $cook->whitelistedNames);
        $this->assertInstanceOf(self::CLASS_CLOUD_FRONT, $cook->whitelistedNames->getCloudFront());
        $this->assertEquals($dist->distributionId, $cook->whitelistedNames->getDistributionId());
        $this->assertEquals(0, count($cook->whitelistedNames));
    }