test: shared Divi fixtures in tests/Support (T1)
- DiviFixtures: markup(), givenPost(), schema(), designSystem(), catalog(), dynamicContentRegistry(), maliciousRefs() - moved verbatim out of DiviPageLoaderTest, DesignSystemTest, ModuleCatalogTest, DynamicContentMapTest and VariableRefTest (its malicious() provider now returns maliciousRefs()). - ComposeFixture moves to tests/Support. - DiviWriterFixture: modules(), designReader(), composition(), a recording saver(), log() and writer(&$saved, &$failures, unfiltered, loader) for the five tests that wired the Divi write stack by hand. No test cases or assertions changed (1397 / 5834). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,15 +6,11 @@ namespace LIT\MCP\Tests\Unit\Integrations\Divi\Pages;
|
||||
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Parser;
|
||||
use LIT\MCP\Integrations\Divi\Compose\VariableRef;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
||||
use LIT\MCP\Integrations\Divi\Pages\DiviComposition;
|
||||
use LIT\MCP\Integrations\Divi\Pages\DiviContentComposer;
|
||||
use LIT\MCP\Integrations\Divi\Pages\DiviSaver;
|
||||
use LIT\MCP\Integrations\Divi\Pages\DynamicContentMap;
|
||||
use LIT\MCP\Integrations\Divi\Schema\DiviModules;
|
||||
use LIT\MCP\Tests\Unit\Integrations\Divi\Compose\ComposeFixture;
|
||||
use LIT\MCP\Tests\Unit\Integrations\Divi\Design\DesignSystemTest;
|
||||
use LIT\MCP\Tests\Unit\Integrations\Divi\Schema\ModuleCatalogTest;
|
||||
use LIT\MCP\Tests\Support\DiviFixtures;
|
||||
use LIT\MCP\Tests\Support\DiviWriterFixture;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
@@ -48,20 +44,16 @@ final class DiviContentComposerTest extends TestCase
|
||||
*/
|
||||
private function composer(bool $diviEnabled = true, ?callable $registry = null): DiviContentComposer
|
||||
{
|
||||
$modules = Mockery::mock(DiviModules::class);
|
||||
$modules->allows('catalog')->andReturn(ModuleCatalogTest::sampleCatalog());
|
||||
$modules->allows('builderVersion')->andReturn('5.2.1');
|
||||
$design = Mockery::mock(DesignSystemReader::class);
|
||||
$design->allows('read')->andReturn(DesignSystemTest::sample());
|
||||
$design = DiviWriterFixture::designReader();
|
||||
$map = new DynamicContentMap(function (int $postId) use ($registry): array {
|
||||
$this->registryCalls[] = $postId;
|
||||
|
||||
return $registry !== null ? $registry($postId) : DynamicContentMapTest::registry();
|
||||
return $registry !== null ? $registry($postId) : DiviFixtures::dynamicContentRegistry();
|
||||
});
|
||||
|
||||
return new DiviContentComposer(
|
||||
DiviPageLoaderTest::schema($diviEnabled),
|
||||
new DiviComposition($modules, $design, ComposeFixture::sanitizer(), ComposeFixture::media(), $map),
|
||||
DiviFixtures::schema($diviEnabled),
|
||||
DiviWriterFixture::composition($design, false, $map),
|
||||
$this->saver,
|
||||
$design
|
||||
);
|
||||
@@ -124,7 +116,7 @@ final class DiviContentComposerTest extends TestCase
|
||||
public function testWriteRefusesWhatTheNewEntrysMapDoesNotOffer(): void
|
||||
{
|
||||
$registry = static function (int $postId): array {
|
||||
$options = DynamicContentMapTest::registry();
|
||||
$options = DiviFixtures::dynamicContentRegistry();
|
||||
if ($postId !== 0) {
|
||||
unset($options['site_title']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user