forked from rackspace/php-opencloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjStoreBaseTest.php
More file actions
78 lines (75 loc) · 1.9 KB
/
ObjStoreBaseTest.php
File metadata and controls
78 lines (75 loc) · 1.9 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
76
77
78
<?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('objstorebase.inc');
require_once('http.inc');
// stub class, since ObjStoreBase is abstract
class MyObjStoreBase extends \OpenCloud\ObjectStore\ObjStoreBase {
public $name='FOOBAR';
}
class ObjStoreBaseTest extends PHPUnit_Framework_TestCase
{
private
$obj;
public function __construct() {
$this->obj = new MyObjStoreBase();
}
/**
* Tests
*/
public function test__construct() {
$this->obj = new MyObjStoreBase();
$this->assertEquals(
'OpenCloud\Metadata',
get_class($this->obj->metadata));
}
/**
* @expectedException OpenCloud\ObjectStore\MetadataPrefixError
*/
public function testGetMetadata() {
$blank = new OpenCloud\BlankResponse();
$blank->headers = array(
'X-Meta-Something'=>'FOO',
'X-Meta-Else'=>'BAR'
);
$this->obj->GetMetadata($blank);
}
/**
* @expectedException OpenCloud\ObjectStore\MetadataPrefixError
*/
public function testMetadataHeaders() {
$this->obj->metadata = new \stdClass();
$this->obj->metadata->foo = 'BAR';
$arr = $this->obj->MetadataHeaders();
$this->assertEquals(
'',
$arr['foo']);
}
public function testName() {
$this->assertEquals(
'FOOBAR',
$this->obj->Name());
}
public function testJsonName() {
$this->assertEquals(
NULL,
$this->obj->JsonName());
}
public function testJsonCollectionName() {
$this->assertEquals(
NULL,
$this->obj->JsonCollectionName());
}
public function testJsonCollectionElement() {
$this->assertEquals(
NULL,
$this->obj->JsonCollectionElement());
}
}