im profil kann ein nutzer nun seine daten exportieren. man kann seinen account löschen. nach 2 jahren werden inaktive accounts gelöscht, 1 monat vorher wird eine email geschickt. Hilfetexte und Legal Pages in der Guest PWA korrigiert und vom layout her optimiert (dark mode).
This commit is contained in:
85
tests/Feature/TenantRetentionCommandTest.php
Normal file
85
tests/Feature/TenantRetentionCommandTest.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Jobs\AnonymizeAccount;
|
||||
use App\Models\Package;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\TenantPackage;
|
||||
use App\Models\User;
|
||||
use App\Notifications\InactiveTenantDeletionWarning;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TenantRetentionCommandTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_inactive_tenant_gets_anonymized(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$tenant = Tenant::factory()->create([
|
||||
'last_activity_at' => now()->subMonths(25),
|
||||
]);
|
||||
$user = User::factory()->create(['tenant_id' => $tenant->id]);
|
||||
$tenant->user()->associate($user)->save();
|
||||
|
||||
$this->artisan('tenants:retention-scan')->assertExitCode(0);
|
||||
Queue::assertPushed(AnonymizeAccount::class, function (AnonymizeAccount $job) use ($tenant) {
|
||||
return $job->tenantId() === $tenant->id;
|
||||
});
|
||||
}
|
||||
|
||||
public function test_warning_is_sent_one_month_before(): void
|
||||
{
|
||||
Queue::fake();
|
||||
Notification::fake();
|
||||
|
||||
$tenant = Tenant::factory()->create([
|
||||
'last_activity_at' => now()->subMonths(23)->subWeek(),
|
||||
'contact_email' => 'owner@example.com',
|
||||
]);
|
||||
$user = User::factory()->create(['tenant_id' => $tenant->id]);
|
||||
$tenant->user()->associate($user)->save();
|
||||
|
||||
$this->artisan('tenants:retention-scan')->assertExitCode(0);
|
||||
|
||||
Notification::assertSentOnDemand(
|
||||
InactiveTenantDeletionWarning::class,
|
||||
function (InactiveTenantDeletionWarning $notification, array $channels, $notifiable) {
|
||||
return in_array('mail', $channels, true);
|
||||
}
|
||||
);
|
||||
|
||||
$this->assertNotNull($tenant->fresh()->deletion_warning_sent_at);
|
||||
}
|
||||
|
||||
public function test_active_subscription_is_whitelisted(): void
|
||||
{
|
||||
Queue::fake();
|
||||
|
||||
$tenant = Tenant::factory()->create([
|
||||
'last_activity_at' => now()->subMonths(25),
|
||||
]);
|
||||
$user = User::factory()->create(['tenant_id' => $tenant->id]);
|
||||
$tenant->user()->associate($user)->save();
|
||||
|
||||
$package = Package::factory()->create(['type' => 'reseller']);
|
||||
TenantPackage::create([
|
||||
'tenant_id' => $tenant->id,
|
||||
'package_id' => $package->id,
|
||||
'price' => 99,
|
||||
'purchased_at' => now()->subMonth(),
|
||||
'expires_at' => now()->addYear(),
|
||||
'used_events' => 0,
|
||||
'active' => true,
|
||||
]);
|
||||
|
||||
$this->artisan('tenants:retention-scan')->assertExitCode(0);
|
||||
|
||||
Queue::assertNothingPushed();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user