44
55use AzureOss \LaravelAzureStorageBlob \AzureStorageBlobAdapter ;
66use AzureOss \LaravelAzureStorageBlob \AzureStorageBlobServiceProvider ;
7+ use AzureOss \Storage \Blob \BlobContainerClient ;
78use AzureOss \Storage \Blob \BlobServiceClient ;
89use Illuminate \Support \Facades \Http ;
910use Illuminate \Support \Facades \Storage ;
@@ -26,6 +27,25 @@ protected function getEnvironmentSetUp($app): void
2627 ]);
2728 }
2829
30+ private static function createContainerClient (): BlobContainerClient
31+ {
32+ $ connectionString = getenv ('AZURE_STORAGE_CONNECTION_STRING ' );
33+
34+ if (empty ($ connectionString )) {
35+ self ::markTestSkipped ('AZURE_STORAGE_CONNECTION_STRING is not provided. ' );
36+ }
37+
38+ return BlobServiceClient::fromConnectionString ($ connectionString )->getContainerClient (
39+ getenv ('AZURE_STORAGE_CONTAINER ' )
40+ );
41+ }
42+
43+ public static function setUpBeforeClass (): void
44+ {
45+ self ::createContainerClient ()->deleteIfExists ();
46+ self ::createContainerClient ()->create ();
47+ }
48+
2949 #[Test]
3050 public function it_resolves_from_manager (): void
3151 {
@@ -35,10 +55,6 @@ public function it_resolves_from_manager(): void
3555 #[Test]
3656 public function driver_works (): void
3757 {
38- BlobServiceClient::fromConnectionString (env ('AZURE_STORAGE_CONNECTION_STRING ' ))
39- ->getContainerClient (env ('AZURE_STORAGE_CONTAINER ' ))
40- ->createIfNotExists ();
41-
4258 $ driver = Storage::disk ('azure ' );
4359
4460 // cleanup from previous test runs
0 commit comments