feat(uptelligence): add AltumCode vendor seeder with 17 entries
Idempotent seeder using updateOrCreate for 4 licensed products (66analytics, 66biolinks, 66pusher, 66socialproof) and 13 plugins. All entries use placeholder version 0.0.0 pending sync from Task 4. Also fixes Pest.php to use Tests\TestCase (loads Boot provider) so database-dependent tests can run migrations via RefreshDatabase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f0a2f3fd1a
commit
a187114d27
3 changed files with 272 additions and 1 deletions
211
database/seeders/AltumCodeVendorSeeder.php
Normal file
211
database/seeders/AltumCodeVendorSeeder.php
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Core\Mod\Uptelligence\Database\Seeders;
|
||||
|
||||
use Core\Mod\Uptelligence\Models\Vendor;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
/**
|
||||
* Seeds the uptelligence_vendors table with AltumCode products and plugins.
|
||||
*
|
||||
* Idempotent: uses updateOrCreate so it can be run multiple times safely.
|
||||
*/
|
||||
class AltumCodeVendorSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
foreach ($this->products() as $product) {
|
||||
Vendor::updateOrCreate(
|
||||
['slug' => $product['slug']],
|
||||
$product,
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($this->plugins() as $plugin) {
|
||||
Vendor::updateOrCreate(
|
||||
['slug' => $plugin['slug']],
|
||||
$plugin,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AltumCode licensed products.
|
||||
*
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
protected function products(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'slug' => '66analytics',
|
||||
'name' => '66analytics',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_LICENSED,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => '66biolinks',
|
||||
'name' => '66biolinks',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_LICENSED,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => '66pusher',
|
||||
'name' => '66pusher',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_LICENSED,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => '66socialproof',
|
||||
'name' => '66socialproof',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_LICENSED,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* AltumCode plugins.
|
||||
*
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
protected function plugins(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'slug' => 'altum-plugin-affiliate',
|
||||
'name' => 'Affiliate Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-push-notifications',
|
||||
'name' => 'Push Notifications Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-teams',
|
||||
'name' => 'Teams Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-pwa',
|
||||
'name' => 'PWA Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-image-optimizer',
|
||||
'name' => 'Image Optimizer Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-email-shield',
|
||||
'name' => 'Email Shield Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-dynamic-og-images',
|
||||
'name' => 'Dynamic OG Images Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-offload',
|
||||
'name' => 'Offload & CDN Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-payment-blocks',
|
||||
'name' => 'Payment Blocks Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-ultimate-blocks',
|
||||
'name' => 'Ultimate Blocks Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-pro-blocks',
|
||||
'name' => 'Pro Blocks Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-pro-notifications',
|
||||
'name' => 'Pro Notifications Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
[
|
||||
'slug' => 'altum-plugin-aix',
|
||||
'name' => 'AIX Plugin',
|
||||
'vendor_name' => 'AltumCode',
|
||||
'source_type' => Vendor::SOURCE_PLUGIN,
|
||||
'plugin_platform' => Vendor::PLATFORM_ALTUM,
|
||||
'current_version' => '0.0.0',
|
||||
'is_active' => true,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Orchestra\Testbench\TestCase;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class)->in('Feature', 'Unit');
|
||||
|
|
|
|||
60
tests/Unit/AltumCodeVendorSeederTest.php
Normal file
60
tests/Unit/AltumCodeVendorSeederTest.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Core\Mod\Uptelligence\Database\Seeders\AltumCodeVendorSeeder;
|
||||
use Core\Mod\Uptelligence\Models\Vendor;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('seeds 4 altum products', function () {
|
||||
$seeder = new AltumCodeVendorSeeder;
|
||||
$seeder->run();
|
||||
|
||||
$products = Vendor::where('source_type', Vendor::SOURCE_LICENSED)
|
||||
->where('plugin_platform', Vendor::PLATFORM_ALTUM)
|
||||
->get();
|
||||
|
||||
expect($products)->toHaveCount(4)
|
||||
->and($products->pluck('slug')->sort()->values()->all())->toBe([
|
||||
'66analytics',
|
||||
'66biolinks',
|
||||
'66pusher',
|
||||
'66socialproof',
|
||||
]);
|
||||
|
||||
$products->each(function (Vendor $vendor) {
|
||||
expect($vendor->vendor_name)->toBe('AltumCode')
|
||||
->and($vendor->is_active)->toBeTrue()
|
||||
->and($vendor->current_version)->toBe('0.0.0');
|
||||
});
|
||||
});
|
||||
|
||||
it('seeds 13 altum plugins', function () {
|
||||
$seeder = new AltumCodeVendorSeeder;
|
||||
$seeder->run();
|
||||
|
||||
$plugins = Vendor::where('source_type', Vendor::SOURCE_PLUGIN)
|
||||
->where('plugin_platform', Vendor::PLATFORM_ALTUM)
|
||||
->get();
|
||||
|
||||
expect($plugins)->toHaveCount(13);
|
||||
|
||||
$plugins->each(function (Vendor $vendor) {
|
||||
expect($vendor->vendor_name)->toBe('AltumCode')
|
||||
->and($vendor->is_active)->toBeTrue()
|
||||
->and($vendor->current_version)->toBe('0.0.0')
|
||||
->and($vendor->slug)->toStartWith('altum-plugin-');
|
||||
});
|
||||
});
|
||||
|
||||
it('is idempotent — running twice still yields 17 total', function () {
|
||||
$seeder = new AltumCodeVendorSeeder;
|
||||
|
||||
$seeder->run();
|
||||
expect(Vendor::count())->toBe(17);
|
||||
|
||||
$seeder->run();
|
||||
expect(Vendor::count())->toBe(17);
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue