feat: Divi-Fähigkeiten (DiviFeature, Requirement, ConstantRequirement) an Call, Mirror und Manifest; alle acht Adapter getaggt; Tests für Vollständigkeit und die gepinnte Zuordnung
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
e6e0f914ba
commit
392fe7c569
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviFeature;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class DiviFeatureTest extends TestCase
|
||||
{
|
||||
public function testTheElevenFeaturesAndTheirValues(): void
|
||||
{
|
||||
self::assertSame(
|
||||
[
|
||||
'PageRead' => 'page-read',
|
||||
'PageWrite' => 'page-write',
|
||||
'Catalog' => 'catalog',
|
||||
'DynamicSources' => 'dynamic-sources',
|
||||
'DesignRead' => 'design-read',
|
||||
'PresetWrite' => 'preset-write',
|
||||
'LibraryRead' => 'library-read',
|
||||
'LibraryWrite' => 'library-write',
|
||||
'Roles' => 'roles',
|
||||
'ThemeBuilderRead' => 'tb-read',
|
||||
'ThemeBuilderWrite' => 'tb-write',
|
||||
],
|
||||
array_column(array_map(
|
||||
static fn (DiviFeature $feature): array => [$feature->name, $feature->value],
|
||||
DiviFeature::cases()
|
||||
), 1, 0)
|
||||
);
|
||||
}
|
||||
|
||||
public function testOnlyTheFourWriteFeaturesWrite(): void
|
||||
{
|
||||
$writing = array_values(array_map(
|
||||
static fn (DiviFeature $feature): string => $feature->value,
|
||||
array_filter(DiviFeature::cases(), static fn (DiviFeature $feature): bool => $feature->isWrite())
|
||||
));
|
||||
|
||||
self::assertSame(['page-write', 'preset-write', 'library-write', 'tb-write'], $writing);
|
||||
}
|
||||
|
||||
public function testEveryFeatureHasAUniqueGermanLabel(): void
|
||||
{
|
||||
$labels = array_map(static fn (DiviFeature $feature): string => $feature->label(), DiviFeature::cases());
|
||||
|
||||
self::assertCount(count(DiviFeature::cases()), array_unique($labels));
|
||||
self::assertSame('Seiten schreiben', DiviFeature::PageWrite->label());
|
||||
self::assertSame('Theme Builder lesen', DiviFeature::ThemeBuilderRead->label());
|
||||
foreach ($labels as $label) {
|
||||
self::assertNotSame('', trim($label));
|
||||
}
|
||||
}
|
||||
|
||||
public function testValuesResolveBackToTheFeature(): void
|
||||
{
|
||||
self::assertSame(DiviFeature::ThemeBuilderWrite, DiviFeature::from('tb-write'));
|
||||
self::assertNull(DiviFeature::tryFrom('page'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user