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)()); } }