diff --git a/src/HPCloud/Storage/CDN.php b/src/HPCloud/Storage/CDN.php index eb22be3..0c54365 100644 --- a/src/HPCloud/Storage/CDN.php +++ b/src/HPCloud/Storage/CDN.php @@ -257,6 +257,10 @@ class CDN { * ?> * @endcode * + * @attention + * The $enabledOnly flag sendes \c enabled_only to the + * endpoint. The endpoint may or may not honor this. + * * @param boolean $enabledOnly * If this is set to TRUE, then only containers that are * CDN-enabled will be returned. @@ -266,13 +270,18 @@ class CDN { * @throws HPCloud::Exception * An HTTP-level exception on error. */ - public function containers($enabledOnly = FALSE) { + public function containers($enabledOnly = NULL) { $client = \HPCloud\Transport::instance(); $url = $this->url . '/?format=json'; if ($enabledOnly) { $url .= '&enabled_only=true'; } + // DEVEX-1733 suggests that this should result in the + // server listing only DISABLED containers. + elseif ($enabledOnly === FALSE) { + $url .= '&enabled_only=false'; + } $headers = array( 'X-Auth-Token' => $this->token, diff --git a/test/Tests/CDNTest.php b/test/Tests/CDNTest.php index e60512f..4e9f332 100644 --- a/test/Tests/CDNTest.php +++ b/test/Tests/CDNTest.php @@ -154,6 +154,43 @@ class CDNTest extends \HPCloud\Tests\TestCase { return $cdn; } + /** + * @ depends testDisable + */ + /* Temporarily removed. It's unclear what exactly + * the correct behavior is supposed to be. + public function testContainersEnabledOnly($cdn) { + $cname = $this->conf('hpcloud.swift.container'); + + \HPCloud\Bootstrap::setConfiguration(array('transport.debug' => 1)); + $containers = $cdn->containers(TRUE); + + throw new \Exception(print_r($containers, TRUE)); + + $found = 0; + foreach ($containers as $container) { + if ($container['name'] == $cname) { + ++$found; + } + } + + $this->assertEquals(0, $found); + + $containers = $cdn->containers(FALSE); + $found = 0; + foreach ($containers as $container) { + if ($container['name'] == $cname) { + ++$found; + } + } + + $this->assertEquals(1, $found); + \HPCloud\Bootstrap::setConfiguration(array('transport.debug' => 0)); + + + } + */ + /** * @depends testDisable */