forked from rackspace/php-opencloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectStoreTest.php
More file actions
75 lines (71 loc) · 1.67 KB
/
ObjectStoreTest.php
File metadata and controls
75 lines (71 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Unit Tests
*
* @copyright 2012-2013 Rackspace Hosting, Inc.
* See COPYING for licensing information
*
* @version 1.0.0
* @author Glen Campbell <glen.campbell@rackspace.com>
*/
require_once('objectstore.inc');
require_once('stub_conn.inc');
/**
* Stub wrapper class so that we can override the request() method
*/
class MyObjectStore extends \OpenCloud\ObjectStore {
public function Request() {
return new OpenCloud\BlankResponse();
}
}
class ObjectStoreTest extends PHPUnit_Framework_TestCase
{
private
$ostore;
public function __construct() {
$conn = new StubConnection('http://example.com','SECRET');
$this->ostore = new MyObjectStore(
$conn,
'cloudFiles',
'DFW',
'publicURL'
);
}
/**
* Tests
*/
public function test__construct() {
$this->assertEquals(TRUE, is_object($this->ostore));
$this->assertEquals(
'MyObjectStore',
get_class($this->ostore));
}
public function testUrl() {
$this->assertEquals(
'https://storage101.dfw1.clouddrive.com/v1/M-ALT-ID',
$this->ostore->Url());
}
public function testContainer() {
$obj = $this->ostore->Container();
$this->assertEquals('OpenCloud\ObjectStore\Container', get_class($obj));
}
public function testContainerList() {
$clist = $this->ostore->ContainerList();
$this->assertEquals(
'OpenCloud\Collection',
get_class($clist));
}
public function testCDN() {
$this->assertEquals(
'OpenCloud\ObjectStoreCDN',
get_class($this->ostore->CDN()));
}
/**
* @expectedException OpenCloud\ObjectStore\CdnError
*/
public function testCDNCDN() {
$this->assertEquals(
FALSE,
get_class($this->ostore->CDN()->CDN()));
}
}