|  | 
| 4 | 4 | 
 | 
| 5 | 5 | namespace AsyncAws\SimpleS3\Tests\Unit; | 
| 6 | 6 | 
 | 
| 7 |  | -use AsyncAws\Core\Configuration; | 
| 8 |  | -use AsyncAws\Core\Credentials\Credentials; | 
| 9 | 7 | use AsyncAws\Core\Credentials\NullProvider; | 
| 10 | 8 | use AsyncAws\SimpleS3\SimpleS3Client; | 
| 11 | 9 | use PHPUnit\Framework\TestCase; | 
| 12 | 10 | use Symfony\Component\HttpClient\MockHttpClient; | 
| 13 | 11 | 
 | 
| 14 | 12 | class SimpleS3ClientTest extends TestCase | 
| 15 | 13 | { | 
| 16 |  | -    public function testGetUrl() | 
|  | 14 | +    public function testGetUrlHostStyle() | 
| 17 | 15 |     { | 
| 18 |  | -        $options = ['region' => 'eu-central-1']; | 
| 19 |  | -        if (\is_callable([Configuration::class, 'optionExists']) && Configuration::optionExists('pathStyleEndpoint')) { | 
| 20 |  | -            $options += ['pathStyleEndpoint' => true]; | 
| 21 |  | -        } | 
| 22 |  | -        $client = new SimpleS3Client($options, new Credentials('id', 'secret'), new MockHttpClient()); | 
|  | 16 | +        $client = new SimpleS3Client(['region' => 'eu-central-1'], new NullProvider(), new MockHttpClient()); | 
| 23 | 17 |         $url = $client->getUrl('bucket', 'images/file.jpg'); | 
| 24 |  | -        self::assertSame('https://s3.eu-central-1.amazonaws.com/bucket/images/file.jpg', $url); | 
|  | 18 | +        self::assertSame('https://bucket.s3.eu-central-1.amazonaws.com/images/file.jpg', $url); | 
| 25 | 19 |     } | 
| 26 | 20 | 
 | 
| 27 |  | -    public function testGetUrlWithNoCredentials() | 
|  | 21 | +    public function testGetUrlPathStyle() | 
| 28 | 22 |     { | 
| 29 |  | -        $options = ['region' => 'eu-central-1']; | 
| 30 |  | -        if (\is_callable([Configuration::class, 'optionExists']) && Configuration::optionExists('pathStyleEndpoint')) { | 
| 31 |  | -            $options += ['pathStyleEndpoint' => true]; | 
| 32 |  | -        } | 
| 33 |  | -        $client = new SimpleS3Client($options, new NullProvider(), new MockHttpClient()); | 
|  | 23 | +        $client = new SimpleS3Client(['region' => 'eu-central-1', 'pathStyleEndpoint' => true], new NullProvider(), new MockHttpClient()); | 
| 34 | 24 |         $url = $client->getUrl('bucket', 'images/file.jpg'); | 
| 35 | 25 |         self::assertSame('https://s3.eu-central-1.amazonaws.com/bucket/images/file.jpg', $url); | 
| 36 | 26 |     } | 
|  | 
0 commit comments