@@ -72,21 +72,47 @@ public function test_Copy()
7272 }
7373
7474 /**
75- * @expectedException OpenCloud\Common\Exceptions\NoNameError
75+ * @expectedException \ OpenCloud\Common\Exceptions\NoNameError
7676 */
7777 public function test_Copy_Fails ()
7878 {
7979 $ this ->container ->dataObject ()->copy (null );
8080 }
8181
8282 /**
83- * @expectedException OpenCloud\Common\Exceptions\InvalidArgumentError
83+ * @expectedException \ OpenCloud\Common\Exceptions\InvalidArgumentError
8484 */
8585 public function test_Temp_Url_Fails_With_Incorrect_Method ()
8686 {
8787 $ this ->container ->dataObject ('foobar ' )->getTemporaryUrl (1000 , 'DELETE ' );
8888 }
8989
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+
90116 public function test_Purge ()
91117 {
92118 $ object = $ this ->container ->dataObject ('foobar ' );
0 commit comments