coupon code system eingeführt. coupons werden vom super admin gemanaged. coupons werden mit paddle synchronisiert und dort validiert. plus: einige mobil-optimierungen im tenant admin pwa.
This commit is contained in:
48
tests/Feature/Console/CouponExportCommandTest.php
Normal file
48
tests/Feature/Console/CouponExportCommandTest.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Console;
|
||||
|
||||
use App\Models\Coupon;
|
||||
use App\Models\CouponRedemption;
|
||||
use App\Models\Package;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CouponExportCommandTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_export_command_creates_csv(): void
|
||||
{
|
||||
Storage::fake('local');
|
||||
|
||||
$coupon = Coupon::factory()->create([
|
||||
'code' => 'FLASH20',
|
||||
]);
|
||||
$package = Package::factory()->create();
|
||||
$tenant = Tenant::factory()->create();
|
||||
|
||||
CouponRedemption::factory()->create([
|
||||
'coupon_id' => $coupon->id,
|
||||
'package_id' => $package->id,
|
||||
'tenant_id' => $tenant->id,
|
||||
'status' => CouponRedemption::STATUS_SUCCESS,
|
||||
'amount_discounted' => 25,
|
||||
'redeemed_at' => now(),
|
||||
]);
|
||||
|
||||
$path = 'reports/test-coupons.csv';
|
||||
|
||||
$this->artisan('coupons:export', [
|
||||
'--days' => 7,
|
||||
'--path' => $path,
|
||||
])->assertExitCode(0);
|
||||
|
||||
Storage::disk('local')->assertExists($path);
|
||||
|
||||
$contents = Storage::disk('local')->get($path);
|
||||
$this->assertStringContainsString('FLASH20', $contents);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user