docs: guides, readme and spec for the Divi Library (v0.4.0)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 03:33:38 +02:00
co-authored by Claude Opus 5.5
parent 8808a7dcdb
commit 2729e2800e
15 changed files with 320 additions and 30 deletions
@@ -63,6 +63,47 @@ final class InstructionsBuilderTest extends TestCase
self::assertLessThan(2000, strlen($with));
}
private function library(): Integration
{
$library = Mockery::mock(Integration::class);
$library->allows('id')->andReturn('divi-library');
$library->allows('isAvailable')->andReturn(true);
$insert = $this->ability('lit/library-insert', true);
$insert->allows('annotations')->andReturn(['readonly' => false]);
$library->allows('abilities')->andReturn([$insert]);
return $library;
}
public function testAddsTheLibraryRuleOnlyWhenTheLibraryGroupIsActive(): void
{
$core = $this->coreWith($this->ability('lit/guide', true));
$with = (new InstructionsBuilder(new IntegrationRegistry($core, $this->library())))->build();
$without = (new InstructionsBuilder(new IntegrationRegistry($core)))->build();
self::assertStringContainsString('Divi-Bibliothek: globale Module', $with);
self::assertStringContainsString('confirm: true', $with);
self::assertStringContainsString('topic "divi-library"', $with);
self::assertStringNotContainsString('Divi-Bibliothek:', $without);
self::assertLessThan(2000, strlen($with));
}
/** "nur lesen" or disabled: the library cannot be written, so the edit rule would only mislead. */
public function testLeavesOutTheLibraryRuleWhenTheGroupCannotWrite(): void
{
$core = $this->coreWith($this->ability('lit/guide', true));
$registry = new IntegrationRegistry($core, $this->library());
foreach ([['@readonly:divi-library' => true], ['@group:divi-library' => 'disabled']] as $settings) {
$policy = (new ExposurePolicy($settings))->withGroups($registry->groupMap());
$text = (new InstructionsBuilder($registry, null, $policy))->build();
self::assertStringNotContainsString('Divi-Bibliothek:', $text, (string) json_encode($settings));
}
}
public function testListsPostTypesWhenAProviderIsGiven(): void
{
$core = $this->coreWith($this->ability('lit/guide', true));