@@ -72,21 +72,47 @@ public function test_Copy()
72
72
}
73
73
74
74
/**
75
- * @expectedException OpenCloud\Common\Exceptions\NoNameError
75
+ * @expectedException \ OpenCloud\Common\Exceptions\NoNameError
76
76
*/
77
77
public function test_Copy_Fails ()
78
78
{
79
79
$ this ->container ->dataObject ()->copy (null );
80
80
}
81
81
82
82
/**
83
- * @expectedException OpenCloud\Common\Exceptions\InvalidArgumentError
83
+ * @expectedException \ OpenCloud\Common\Exceptions\InvalidArgumentError
84
84
*/
85
85
public function test_Temp_Url_Fails_With_Incorrect_Method ()
86
86
{
87
87
$ this ->container ->dataObject ('foobar ' )->getTemporaryUrl (1000 , 'DELETE ' );
88
88
}
89
89
90
+ public function test_Temp_Url_Inherits_Url_Type ()
91
+ {
92
+ $ service = $ this ->getClient ()->objectStoreService (null , 'IAD ' , 'internalURL ' );
93
+ $ object = $ service ->getContainer ('foo ' )->dataObject ('bar ' );
94
+
95
+ $ this ->addMockSubscriber (new Response (204 , ['X-Account-Meta-Temp-URL-Key ' => 'secret ' ]));
96
+
97
+ $ tempUrl = $ object ->getTemporaryUrl (60 , 'GET ' );
98
+
99
+ // Check that internal URLs are used
100
+ $ this ->assertContains ('snet-storage ' , $ tempUrl );
101
+ }
102
+
103
+ public function test_temp_urls_can_be_forced_to_use_public_urls ()
104
+ {
105
+ $ service = $ this ->getClient ()->objectStoreService (null , 'IAD ' , 'internalURL ' );
106
+ $ object = $ service ->getContainer ('foo ' )->dataObject ('bar ' );
107
+
108
+ $ this ->addMockSubscriber (new Response (204 , ['X-Account-Meta-Temp-URL-Key ' => 'secret ' ]));
109
+
110
+ $ tempUrl = $ object ->getTemporaryUrl (60 , 'GET ' , true );
111
+
112
+ // Check that internal URLs are NOT used
113
+ $ this ->assertNotContains ('snet-storage ' , $ tempUrl );
114
+ }
115
+
90
116
public function test_Purge ()
91
117
{
92
118
$ object = $ this ->container ->dataObject ('foobar ' );
0 commit comments