File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed
Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 1919 */
2020class BackblazeS3 extends AmazonS3v3
2121{
22+
2223 /**
2324 * Create the Backblaze AWS client.
2425 *
@@ -44,8 +45,8 @@ protected function createClient() : S3Client
4445 *
4546 * @return string
4647 */
47- private function createEndpoint ()
48+ protected function createEndpoint ()
4849 {
49- return strtr ( ' https://s3.{region}.backblazeb2.com ', ' {region} ' , $ this -> region );
50+ return str_replace ( ' {region} ' , $ this -> region , ' https://s3.{region}.backblazeb2.com ' );
5051 }
5152}
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ class BackblazeS3Test extends TestCase
2424 */
2525 public function testSetUpOk ()
2626 {
27- $ amazonS3 = new BackblazeS3 ();
28- $ amazonS3 ->setup ([
27+ $ b2 = new BackblazeS3 ();
28+ $ b2 ->setup ([
2929 'key ' => 'dummy-key ' ,
3030 'secret ' => 'dummy-secret ' ,
3131 'bucket ' => 'dummy-bucket ' ,
@@ -36,4 +36,23 @@ public function testSetUpOk()
3636 $ this ->assertTrue (true , 'no exception should occur ' );
3737 }
3838
39- }
39+ public function testEndpoint ()
40+ {
41+ $ b2 = new BackblazeS3 ();
42+ $ b2 ->setup ([
43+ 'key ' => 'dummy-key ' ,
44+ 'secret ' => 'dummy-secret ' ,
45+ 'bucket ' => 'dummy-bucket ' ,
46+ 'region ' => 'dummy-region ' ,
47+ 'path ' => '/ '
48+ ]);
49+
50+ $ createEndpointPrivateMethod = function () {
51+ return $ this ->createEndpoint ();
52+ };
53+
54+ $ createEndpointClosure = $ createEndpointPrivateMethod ->bindTo ($ b2 , $ b2 );
55+
56+ $ this ->assertEquals ($ createEndpointClosure (), 'https://s3.dummy-region.backblazeb2.com ' );
57+ }
58+ }
You can’t perform that action at this time.
0 commit comments