ReleaseStore, CheckReportStore, CheckReport, CheckStep und CompatibilityCheck liegen im Kern und arbeiten je Profil (Optionen lit_mcp_<id>_releases|_check_report; Divi behält Namen und Schlüssel divi_version). Divi hängt Katalog-, Format- und Schreibtest über Profile::extraSteps an. Ein roter Prüfbericht für den aktuellen Stand sperrt LockOnFailure-Profile bis zur nächsten grünen Prüfung; Sperrgründe nennen nur Schritt-Labels, Ausnahmen gehen ins Error-Log. Profile bekommt testedVersions, stateKey, extraSteps, manifestCheck und reportVersionKey und wird mit benannten Argumenten gebaut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76 lines
2.9 KiB
PHP
76 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
|
|
|
|
use Brain\Monkey\Functions;
|
|
use LIT\MCP\Compatibility\ManifestCheck;
|
|
use LIT\MCP\Compatibility\ReleaseState;
|
|
use LIT\MCP\Compatibility\Tier;
|
|
use LIT\MCP\Integrations\Divi\Release\DiviAdapters;
|
|
use LIT\MCP\Integrations\Divi\Release\DiviFeature;
|
|
use LIT\MCP\Integrations\Divi\Release\DiviProfile;
|
|
use LIT\MCP\Integrations\Divi\Release\DiviReleases;
|
|
use LIT\MCP\Integrations\Divi\Release\ReleaseGate;
|
|
use LIT\MCP\Integrations\Divi\Release\ReleaseResolver;
|
|
use LIT\MCP\Tests\Support\ReleaseMatrices;
|
|
use LIT\MCP\Tests\Unit\TestCase;
|
|
use Mockery;
|
|
|
|
final class DiviProfileTest extends TestCase
|
|
{
|
|
private function theme(string $template, string $version = '5.2.1'): void
|
|
{
|
|
$theme = Mockery::mock();
|
|
$theme->allows('get_template')->andReturn($template);
|
|
$theme->allows('parent')->andReturn(false);
|
|
$theme->allows('get')->with('Version')->andReturn($version);
|
|
Functions\when('wp_get_theme')->justReturn($theme);
|
|
}
|
|
|
|
public function testDescribesDiviAsAReleasePerVersionPlugin(): void
|
|
{
|
|
$profile = DiviProfile::profile();
|
|
|
|
self::assertSame('divi', $profile->id);
|
|
self::assertSame('Divi', $profile->label);
|
|
self::assertSame('divi_version', $profile->reportVersionKey, 'stored Divi data keeps its key');
|
|
self::assertSame(DiviProfile::ID, $profile->id);
|
|
self::assertSame(DiviProfile::REPORT_VERSION_KEY, $profile->reportVersionKey);
|
|
self::assertSame(Tier::ReleasePerVersion, $profile->tier);
|
|
self::assertSame(DiviFeature::cases(), $profile->capabilities);
|
|
self::assertEquals(array_values(DiviAdapters::manifests()), $profile->manifests);
|
|
}
|
|
|
|
public function testTheMatrixIsTheReleaseGatesMatrix(): void
|
|
{
|
|
$status = ReleaseMatrices::status([DiviFeature::PageWrite], ReleaseState::Incompatible);
|
|
ReleaseGate::useResolver(static fn () => $status);
|
|
|
|
self::assertSame($status->matrix, (DiviProfile::profile()->matrix)());
|
|
}
|
|
|
|
public function testTheVersionComesFromTheDiviTemplateAndActiveMeansDiviIsInstalled(): void
|
|
{
|
|
$this->theme('Divi', '5.3.0');
|
|
$profile = DiviProfile::profile();
|
|
self::assertTrue(($profile->active)());
|
|
self::assertSame('5.3.0', ($profile->version)());
|
|
|
|
$this->theme('twentytwentyfive');
|
|
self::assertFalse(($profile->active)());
|
|
self::assertNull(($profile->version)());
|
|
}
|
|
|
|
public function testCarriesTestedVersionsStateKeyAndManifestCheck(): void
|
|
{
|
|
$this->theme('twentytwentyfive');
|
|
$profile = DiviProfile::profile();
|
|
|
|
self::assertSame(DiviReleases::TESTED, $profile->testedVersions);
|
|
self::assertSame(ReleaseResolver::stateKey('5.3.0'), ($profile->stateKey)('5.3.0'));
|
|
self::assertInstanceOf(ManifestCheck::class, ($profile->manifestCheck)());
|
|
}
|
|
}
|