CustomEntityXmlSchemaValidator example

/** * @internal * * @covers \Shopware\Core\System\CustomEntity\Xml\CustomEntityXmlSchemaValidator */
class CustomEntityXmlSchemaValidatorTest extends TestCase
{
    public function testValidateThrowsExceptionIfEntitiesNotDefined(): void
    {
        $schema = new CustomEntityXmlSchema(__DIR__, null);

        $validator = new CustomEntityXmlSchemaValidator();

        $this->expectException(\RuntimeException::class);
        $this->expectExceptionMessage('No entities found in parsed xml file');

        $validator->validate($schema);
    }

    /** * @param class-string<\Throwable> $exceptionClass * * @dataProvider xmlProvider */
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(),
        );

        static::assertNull(
            
Home | Imprint | This part of the site doesn't use cookies.