AdminUiXmlSchemaValidator example

/** * @var Entity[] */
    private array $customEntities;

    protected function setUp(): void
    {
        parent::setUp();

        $this->customEntityEnrichmentService = new CustomEntityEnrichmentService(
            new AdminUiXmlSchemaValidator()
        );
        $this->entitySchema = $this->getCustomEntities();
        $this->adminUiXmlSchema = $this->getAdminUiXmlSchema();

        /** @var Entities $outerEntities */
        $outerEntities = $this->entitySchema->getEntities();
        $this->customEntities = $outerEntities->getEntities();
    }

    public function testEnrichCmsAwareAffectedEntities(): void
    {
        

class CustomEntityLifecycleServiceTest extends TestCase
{
    public function testResultIsNullIfThereIsNoExtension(): void
    {
        $customEntityPersister = $this->createMock(CustomEntityPersister::class);
        $customEntityPersister->expects(static::never())->method('update');

        $customEntitySchemaUpdater = $this->createMock(CustomEntitySchemaUpdater::class);
        $customEntitySchemaUpdater->expects(static::never())->method('update');

        $adminUiXmlSchemaValidator = new AdminUiXmlSchemaValidator();
        $customEntityEnrichmentService = new CustomEntityEnrichmentService($adminUiXmlSchemaValidator);

        $customEntityXmlSchemaValidator = new CustomEntityXmlSchemaValidator();

        $customEntityLifecycleService = new CustomEntityLifecycleService(
            $customEntityPersister,
            $customEntitySchemaUpdater,
            $customEntityEnrichmentService,
            $customEntityXmlSchemaValidator,
            '',
            $this->createAppLoader(),
        );
$adminUiXmlSchema = AdminUiXmlSchema::createFromXmlFile(
            __DIR__ . "/../../../_fixtures/AdminUiXmlSchemaValidatorTest/$fixturePath/" . AdminUiXmlSchema::FILENAME
        );
        $customEntityXmlSchema = CustomEntityXmlSchema::createFromXmlFile(
            __DIR__ . "/../../../_fixtures/AdminUiXmlSchemaValidatorTest/$fixturePath/" . CustomEntityXmlSchema::FILENAME
        );

        static::assertNotNull($adminUiEntities = $adminUiXmlSchema->getAdminUi()?->getEntities());
        static::assertNotNull($customEntities = $customEntityXmlSchema->getEntities()?->getEntities());
        static::assertInstanceOf(AdminUiEntity::class$adminUiEntity = \array_pop($adminUiEntities));
        static::assertInstanceOf(Entity::class$customEntity = \array_pop($customEntities));
        (new AdminUiXmlSchemaValidator())->validateConfigurations(
            $adminUiEntity,
            $customEntity,
        );
    }
}
Home | Imprint | This part of the site doesn't use cookies.