Skip to content

Commit 5e3eeb4

Browse files
committed
add test commands to main branch for upcoming test on acceptation server
1 parent a4a1137 commit 5e3eeb4

3 files changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use Illuminate\Support\Facades\Storage;
7+
8+
class TestSharedStorageDeleteCommand extends Command
9+
{
10+
protected $signature = 'app:test-shared-storage-delete';
11+
12+
protected $description = 'Test deleting file and directory from shared_storage disk';
13+
14+
public function handle(): void
15+
{
16+
if(!Storage::disk('shared_storage')->exists('test/test.txt')) {
17+
$this->fail('File does not exist!');
18+
}
19+
20+
Storage::disk('shared_storage')->delete('test/test.txt');
21+
if(Storage::disk('shared_storage')->exists('test/test.txt')) {
22+
$this->fail('Failed to delete file!');
23+
}
24+
25+
$this->info('File deleted successfully!');
26+
27+
Storage::disk('shared_storage')->deleteDirectory('test');
28+
29+
if(Storage::disk('shared_storage')->exists('test')) {
30+
$this->fail('Failed to delete directory!');
31+
}
32+
33+
$this->info('Directory deleted successfully!');
34+
}
35+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use Illuminate\Support\Facades\Storage;
7+
8+
class TestSharedStorageReadCommand extends Command
9+
{
10+
protected $signature = 'app:test-shared-storage-read';
11+
12+
protected $description = 'Test reading file from shared_storage disk';
13+
14+
public function handle()
15+
{
16+
$this->info('Reading file from shared disk');
17+
18+
if(!Storage::disk('shared_storage')->exists('test/test.txt')) {
19+
$this->fail('Failed to read file!');
20+
}
21+
22+
if('Hello, world!' !== Storage::disk('shared_storage')->get('test/test.txt')) {
23+
$this->fail('Unexpected file content!');
24+
}
25+
26+
$this->info('File read successfully!');
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use Illuminate\Support\Facades\Storage;
7+
8+
class TestSharedStorageWriteCommand extends Command
9+
{
10+
protected $signature = 'app:test-shared-storage-write';
11+
12+
protected $description = 'Test writing file to shared_storage disk';
13+
14+
public function handle(): void
15+
{
16+
$this->info('Creating directory on shared disk');
17+
Storage::disk('shared_storage')->makeDirectory('test');
18+
19+
$this->info('Writing file to shared disk');
20+
Storage::disk('shared_storage')->put('test/test.txt', 'Hello, world!');
21+
22+
if(!Storage::disk('shared_storage')->exists('test/test.txt')) {
23+
$this->fail('Failed to write file!');
24+
}
25+
26+
$this->info('File written successfully!');
27+
}
28+
}

0 commit comments

Comments
 (0)