mirror of
https://gh.wpcy.net/https://github.com/fairpm/aspirecloud.git
synced 2026-06-20 02:22:28 +08:00
* fix: rm last vestiges of SyncPlugin * refactor: move Sanctum tests into their own dir * tests: zap example tests * test: break helpers out into the tests/Helpers dir * build: composer bump * refactor: rm unused TranslationData class * build: run composer update since bump does not (WTF) * refactor: move docker app from /var/www/html to /app this is the de facto standard for docker apps, and it makes config much simpler if we follow it * build: upgrade dockerfiles to composer 2.8 * build: tweak composer invocation for prod * tests: rm placeholder that never got filled out * tests: write tests for sync themes/plugins * tests: put back dummy unit test because pest freaks out w/ an empty dir * tests: rm copypasta from SyncThemeTest * build: bump after update, silly, not before
50 lines
2 KiB
PHP
50 lines
2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Models\WpOrg\ClosedPlugin;
|
|
use App\Models\WpOrg\Plugin;
|
|
|
|
describe('Sync Closed Plugins', function () {
|
|
$md_0gravatar = [
|
|
"slug" => "0gravatar",
|
|
"name" => "Display Name If No Gravatar",
|
|
"status" => "closed",
|
|
"error" => "closed",
|
|
"description" => "This plugin has been closed as of November 13, 2024 and is not available for download. This closure is permanent. Reason: Author Request.",
|
|
"closed" => true,
|
|
"closed_date" => "2024-11-13",
|
|
"reason" => "author-request",
|
|
"reason_text" => "Author Request",
|
|
"aspiresync_meta" => [
|
|
"id" => "01933d0c-12a4-72a3-a042-52cd65f40126",
|
|
"type" => "plugin",
|
|
"slug" => "0gravatar",
|
|
"name" => "Display Name If No Gravatar",
|
|
"status" => "closed",
|
|
"version" => null,
|
|
"origin" => "wp_org",
|
|
"updated" => "2024-11-13",
|
|
"pulled" => "2024-11-18T02:13:41+00:00",
|
|
],
|
|
];
|
|
|
|
it('loads as ClosedPlugin', function () use ($md_0gravatar) {
|
|
$plugin = ClosedPlugin::fromSyncMetadata($md_0gravatar);
|
|
expect($plugin)
|
|
->toBeInstanceOf(ClosedPlugin::class)
|
|
->and($plugin->slug)->toBe('0gravatar')
|
|
->and($plugin->name)->toBe('Display Name If No Gravatar')
|
|
->and($plugin->description)->toBe('This plugin has been closed as of November 13, 2024 and is not available for download. This closure is permanent. Reason: Author Request.')
|
|
->and($plugin->closed_date)->toBeBetween(new DateTime('2024-11-13'), new DateTime('2024-11-14'))
|
|
->and($plugin->reason)->toBe('author-request')
|
|
->and($plugin->ac_shadow_id)->toBeNull()
|
|
->and($plugin->ac_origin)->toBe('wp_org');
|
|
});
|
|
|
|
it('throws an exception if loaded as Plugin', function () use ($md_0gravatar) {
|
|
expect(function () use ($md_0gravatar) {
|
|
Plugin::fromSyncMetadata($md_0gravatar);
|
|
})->toThrow(InvalidArgumentException::class);
|
|
});
|
|
});
|