implemented event package addons with filament resource, event-admin purchase path and notifications, showing up in purchase history
This commit is contained in:
43
tests/Unit/Services/EventAddonCatalogTest.php
Normal file
43
tests/Unit/Services/EventAddonCatalogTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services;
|
||||
|
||||
use App\Models\PackageAddon;
|
||||
use App\Services\Addons\EventAddonCatalog;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EventAddonCatalogTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_prefers_database_addons_over_config(): void
|
||||
{
|
||||
Config::set('package-addons', [
|
||||
'extra_photos_small' => [
|
||||
'label' => 'Config Photos',
|
||||
'price_id' => 'pri_config',
|
||||
'increments' => ['extra_photos' => 100],
|
||||
],
|
||||
]);
|
||||
|
||||
PackageAddon::create([
|
||||
'key' => 'extra_photos_small',
|
||||
'label' => 'DB Photos',
|
||||
'price_id' => 'pri_db',
|
||||
'extra_photos' => 200,
|
||||
'active' => true,
|
||||
'sort' => 1,
|
||||
]);
|
||||
|
||||
$catalog = $this->app->make(EventAddonCatalog::class);
|
||||
|
||||
$addon = $catalog->find('extra_photos_small');
|
||||
|
||||
$this->assertNotNull($addon);
|
||||
$this->assertSame('DB Photos', $addon['label']);
|
||||
$this->assertSame('pri_db', $addon['price_id']);
|
||||
$this->assertSame(200, $addon['increments']['extra_photos']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user