- added it_delete_expired_shared_links test

This commit is contained in:
Peter Papp
2021-03-02 17:10:32 +01:00
parent 617ba2a6a8
commit 0748f8face

View File

@@ -3,6 +3,7 @@
namespace Tests\Feature;
use App\Models\File;
use App\Models\Share;
use App\Models\Zip;
use App\Services\SchedulerService;
use App\Services\SetupService;
@@ -23,6 +24,24 @@ class SchedulerTest extends TestCase
$this->scheduler = app()->make(SchedulerService::class);
}
/**
* @test
*/
public function it_delete_expired_shared_links()
{
$share = Share::factory(Share::class)
->create([
'expire_in' => 24,
'created_at' => Carbon::now()->subDay(),
]);
$this->scheduler->delete_expired_shared_links();
$this->assertDatabaseMissing('shares', [
'id' => $share->id
]);
}
/**
* @test
*/
@@ -38,7 +57,7 @@ class SchedulerTest extends TestCase
Storage::putFileAs('zip', $file, 'EHWKcuvKzA4Gv29v-archive.zip');
$zip = Zip::factory(Zip::class)->create([
'basename' => 'EHWKcuvKzA4Gv29v-archive.zip',
'basename' => 'EHWKcuvKzA4Gv29v-archive.zip',
'created_at' => Carbon::now()->subDay(),
]);