feat: Fähigkeiten theme-option-read/-write und font-upload; ThemeOptionsAdapter und FontCatalog (Manifest, Nachbau customizer-typography, Signatur-Referenzen) und DesignRights::themeOptions()/fonts()
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
8379c55c89
commit
a90cd7f5bd
@@ -6,8 +6,10 @@ namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemWriter;
|
||||
use LIT\MCP\Integrations\Divi\Design\FontCatalog;
|
||||
use LIT\MCP\Integrations\Divi\Design\GlobalColorsAdapter;
|
||||
use LIT\MCP\Integrations\Divi\Design\GlobalVariablesAdapter;
|
||||
use LIT\MCP\Integrations\Divi\Design\ThemeOptionsAdapter;
|
||||
use LIT\MCP\Integrations\Divi\Library\DiviLibraryStore;
|
||||
use LIT\MCP\Integrations\Divi\Library\DiviRoles;
|
||||
use LIT\MCP\Integrations\Divi\Pages\DiviPages;
|
||||
@@ -82,6 +84,26 @@ final class DiviFeatureAssignmentTest extends TestCase
|
||||
'GlobalData::set_global_variables()' => ['variable-write'],
|
||||
'et_pb_is_allowed()' => ['variable-write'],
|
||||
],
|
||||
ThemeOptionsAdapter::class => [
|
||||
'et_sanitize_font_choices()' => ['theme-option-write'],
|
||||
'et_sanitize_global_font_weight()' => ['theme-option-write'],
|
||||
'et_sanitize_float_number()' => ['theme-option-write'],
|
||||
'et_sanitize_int_number()' => ['theme-option-write'],
|
||||
'et_divi_global_font_style()' => ['theme-option-write'],
|
||||
'et_update_option()' => ['theme-option-write'],
|
||||
'et_delete_option()' => ['theme-option-write'],
|
||||
'ET_Core_PageResource::remove_static_resources()' => ['theme-option-write'],
|
||||
'et_pb_force_regenerate_templates()' => ['theme-option-write'],
|
||||
'et_pb_is_allowed()' => ['theme-option-write'],
|
||||
'Nachbau et_divi_customizer_theme_settings()' => ['theme-option-read', 'theme-option-write'],
|
||||
],
|
||||
FontCatalog::class => [
|
||||
'et_builder_get_fonts()' => ['font-upload', 'theme-option-write', 'variable-write'],
|
||||
'et_builder_get_custom_fonts()' => ['font-upload', 'theme-option-write', 'variable-write'],
|
||||
'et_builder_get_google_fonts()' => ['font-upload', 'theme-option-write', 'variable-write'],
|
||||
'et_builder_get_websafe_fonts()' => ['font-upload', 'theme-option-write', 'variable-write'],
|
||||
'et_pb_is_allowed()' => ['font-upload'],
|
||||
],
|
||||
DiviModules::class => [
|
||||
'ModuleRegistration::get_all_core_modules_metadata()' => ['catalog'],
|
||||
'ModuleRegistration::get_default_attrs()' => ['catalog'],
|
||||
@@ -143,7 +165,7 @@ final class DiviFeatureAssignmentTest extends TestCase
|
||||
}
|
||||
|
||||
self::assertSame(self::EXPECTED, $actual);
|
||||
self::assertSame(array_keys(self::EXPECTED), DiviAdapters::CLASSES, 'all ten adapters, in report order');
|
||||
self::assertSame(array_keys(self::EXPECTED), DiviAdapters::CLASSES, 'all twelve adapters, in report order');
|
||||
}
|
||||
|
||||
public function testReadingAdaptersCarryNoWriteFeature(): void
|
||||
|
||||
@@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class DiviFeatureTest extends TestCase
|
||||
{
|
||||
public function testTheThirteenFeaturesAndTheirValues(): void
|
||||
public function testTheSixteenFeaturesAndTheirValues(): void
|
||||
{
|
||||
self::assertSame(
|
||||
[
|
||||
@@ -21,6 +21,9 @@ final class DiviFeatureTest extends TestCase
|
||||
'PresetWrite' => 'preset-write',
|
||||
'ColorWrite' => 'color-write',
|
||||
'VariableWrite' => 'variable-write',
|
||||
'ThemeOptionRead' => 'theme-option-read',
|
||||
'ThemeOptionWrite' => 'theme-option-write',
|
||||
'FontUpload' => 'font-upload',
|
||||
'LibraryRead' => 'library-read',
|
||||
'LibraryWrite' => 'library-write',
|
||||
'Roles' => 'roles',
|
||||
@@ -34,7 +37,7 @@ final class DiviFeatureTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testOnlyTheSixWriteFeaturesWrite(): void
|
||||
public function testOnlyTheEightWriteFeaturesWrite(): void
|
||||
{
|
||||
$writing = array_values(array_map(
|
||||
static fn (DiviFeature $feature): string => $feature->value,
|
||||
@@ -42,7 +45,10 @@ final class DiviFeatureTest extends TestCase
|
||||
));
|
||||
|
||||
self::assertSame(
|
||||
['page-write', 'preset-write', 'color-write', 'variable-write', 'library-write', 'tb-write'],
|
||||
[
|
||||
'page-write', 'preset-write', 'color-write', 'variable-write', 'theme-option-write', 'font-upload',
|
||||
'library-write', 'tb-write',
|
||||
],
|
||||
$writing
|
||||
);
|
||||
}
|
||||
@@ -56,6 +62,9 @@ final class DiviFeatureTest extends TestCase
|
||||
self::assertSame('Theme Builder lesen', DiviFeature::ThemeBuilderRead->label());
|
||||
self::assertSame('Farben schreiben', DiviFeature::ColorWrite->label());
|
||||
self::assertSame('Variablen schreiben', DiviFeature::VariableWrite->label());
|
||||
self::assertSame('Theme-Optionen lesen', DiviFeature::ThemeOptionRead->label());
|
||||
self::assertSame('Theme-Optionen schreiben', DiviFeature::ThemeOptionWrite->label());
|
||||
self::assertSame('Schriften hochladen', DiviFeature::FontUpload->label());
|
||||
foreach ($labels as $label) {
|
||||
self::assertNotSame('', trim($label));
|
||||
}
|
||||
@@ -64,6 +73,7 @@ final class DiviFeatureTest extends TestCase
|
||||
public function testValuesResolveBackToTheFeature(): void
|
||||
{
|
||||
self::assertSame(DiviFeature::ThemeBuilderWrite, DiviFeature::from('tb-write'));
|
||||
self::assertSame(DiviFeature::ThemeOptionWrite, DiviFeature::from('theme-option-write'));
|
||||
self::assertNull(DiviFeature::tryFrom('page'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user