feat: Divi hints point to the read tools; guides divi-structure/attrs/design-system; test: Divi read end-to-end
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -45,6 +45,22 @@ final class InstructionsBuilderTest extends TestCase
|
||||
self::assertLessThan(2000, strlen($text), 'Instructions must stay short – they are loaded in every conversation.');
|
||||
}
|
||||
|
||||
public function testAddsTheDiviRuleOnlyWhenDiviIsActive(): void
|
||||
{
|
||||
$divi = Mockery::mock(Integration::class);
|
||||
$divi->allows('id')->andReturn('divi');
|
||||
$divi->allows('isAvailable')->andReturn(true);
|
||||
$divi->allows('abilities')->andReturn([$this->ability('lit/divi-outline', true)]);
|
||||
$core = $this->coreWith($this->ability('lit/guide', true));
|
||||
|
||||
$with = (new InstructionsBuilder(new IntegrationRegistry($core, $divi)))->build();
|
||||
$without = (new InstructionsBuilder(new IntegrationRegistry($core)))->build();
|
||||
|
||||
self::assertStringContainsString('lit-divi-outline und lit-divi-design-system lesen', $with);
|
||||
self::assertStringNotContainsString('lit-divi-outline und', $without);
|
||||
self::assertLessThan(2000, strlen($with));
|
||||
}
|
||||
|
||||
public function testListsPostTypesWhenAProviderIsGiven(): void
|
||||
{
|
||||
$core = $this->coreWith($this->ability('lit/guide', true));
|
||||
|
||||
@@ -10,6 +10,7 @@ use LIT\MCP\Abilities\Rev;
|
||||
use LIT\MCP\Abilities\WriteFailed;
|
||||
use LIT\MCP\ChangeLog\ChangeLog;
|
||||
use LIT\MCP\Integrations\WordPress\Content\ContentUpdateAbility;
|
||||
use LIT\MCP\Integrations\WordPress\Content\PostPresenter;
|
||||
use LIT\MCP\Integrations\WordPress\Content\PostWriter;
|
||||
use LIT\MCP\Integrations\WordPress\Schema\ContentSchema;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
@@ -116,9 +117,7 @@ final class ContentUpdateAbilityTest extends TestCase
|
||||
->execute(['post_id' => 5, 'rev' => Rev::ofPost($this->post), 'content' => '<p>Neu</p>']);
|
||||
|
||||
self::assertSame('lit_unsupported', $result->get_error_code());
|
||||
self::assertStringNotContainsString('lit-divi', $result->get_error_message());
|
||||
self::assertStringContainsString('Divi-Werkzeuge folgen in einer späteren Version; bis dahin im Divi-Builder '
|
||||
. 'bearbeiten.', $result->get_error_data()['hint']);
|
||||
self::assertStringContainsString(PostPresenter::DIVI_INACTIVE_NOTE, $result->get_error_data()['hint']);
|
||||
}
|
||||
|
||||
public function testNothingToChangeIsAValidationError(): void
|
||||
|
||||
@@ -87,13 +87,20 @@ final class PostPresenterTest extends TestCase
|
||||
self::assertTrue($full['divi']);
|
||||
self::assertNull($full['content']);
|
||||
self::assertNull($full['featured_image']);
|
||||
self::assertStringNotContainsString('lit-divi', $full['hints'][0]);
|
||||
self::assertStringContainsString('Divi-Werkzeuge folgen in einer späteren Version', $full['hints'][0]);
|
||||
self::assertSame([PostPresenter::diviHint(false)], $full['hints']);
|
||||
self::assertInstanceOf(stdClass::class, $full['terms']);
|
||||
self::assertInstanceOf(stdClass::class, $full['fields']);
|
||||
self::assertSame(Rev::ofPost($post), $full['rev']);
|
||||
}
|
||||
|
||||
public function testDiviHintNamesTheDiviToolsOnlyWhenDiviIsActive(): void
|
||||
{
|
||||
self::assertStringContainsString('lit-divi-outline', PostPresenter::diviHint(true));
|
||||
self::assertStringContainsString('lit-content-update', PostPresenter::diviHint(true));
|
||||
self::assertStringNotContainsString('lit-divi', PostPresenter::diviHint(false));
|
||||
self::assertStringContainsString(PostPresenter::DIVI_INACTIVE_NOTE, PostPresenter::diviHint());
|
||||
}
|
||||
|
||||
public function testPasswordAndProtectedReadonlyMetaFieldsAreOmitted(): void
|
||||
{
|
||||
$this->stubLinks();
|
||||
|
||||
@@ -66,7 +66,7 @@ final class RevisionsListAbilityTest extends TestCase
|
||||
|
||||
self::assertTrue($result['items'][0]['divi']);
|
||||
self::assertFalse($result['items'][1]['divi']);
|
||||
self::assertSame([PostPresenter::DIVI_HINT], $result['hints']);
|
||||
self::assertSame([PostPresenter::diviHint()], $result['hints']);
|
||||
}
|
||||
|
||||
public function testRevisionsOfATrashedPostCanStillBeListed(): void
|
||||
|
||||
Reference in New Issue
Block a user