function testListDir() { $bucket = $this->getS3Bucket(); $s3 = $this->getS3Client(); $s3->expectOnce('getBucket', array('bin.staticlocal.ch', 'foo/bar/dir/')); $s3->setReturnValue('getBucket', array('foo/bar/dir/bxabcdef.link' => array('name' => 'foo/bar/dir/bxabcdef.link', 'time' => strtotime('2008-06-26 18:53:20'), 'size' => 30, 'hash' => 'somehash'))); // Retrieve the link returned by getBucket $s3->expectAt(0, 'getObject', array('bin.staticlocal.ch', 'foo/bar/dir/bxabcdef.link')); $s3->setReturnValueAt(0, 'getObject', $this->prepareGetObjectResponse(json_encode(array('link' => '../../bx/bxabcdef/index.xml', 'mtime' => $this->time)))); // Follow the link and retrieve the actual content $s3->expectAt(1, 'getObject', array('bin.staticlocal.ch', 'foo/bx/bxabcdef/index.xml')); $s3->setReturnValueAt(1, 'getObject', $this->prepareGetObjectResponse(file_get_contents(dirname(__FILE__) . '/../res/example_asset.xml'))); $s3->expectOnce('getObjectInfo'); $s3->setReturnValue('getObjectInfo', true); $storage = new binarypool_storage_driver_s3($bucket['storage'], $s3, $this->getMockCache(), $this->time); $retval = $storage->listDir('foo/bar/dir/'); $this->assertEqual($retval, array('market/f3/f3584d8f3729f7a91133648483068e73f27447b9/index.xml')); }