CustomEntityXmlSchema example

foreach ($columns as $column) {
            // strtolower required for assertContains             static::assertContains(\strtolower($column)$existing, 'Column ' . $column . ' not found in table ' . $table . ': ' . \print_r($existing, true));
        }
    }

    private function testCreateFromXml(): void
    {
        $entities = CustomEntityXmlSchema::createFromXmlFile(__DIR__ . '/_fixtures/custom-entity-test/Resources/entities.xml');

        $expected = new CustomEntityXmlSchema(
            __DIR__ . '/_fixtures/custom-entity-test/Resources',
            new Entities([
                new Entity([
                    'name' => 'custom_entity_blog',
                    'fields' => [
                        new IntField(['name' => 'position', 'storeApiAware' => true]),
                        new FloatField(['name' => 'rating', 'storeApiAware' => true]),
                        new StringField(['name' => 'title', 'storeApiAware' => true, 'required' => true, 'translatable' => true]),
                        new TextField(['name' => 'content', 'storeApiAware' => true, 'allowHtml' => true, 'translatable' => true]),
                        new BoolField(['name' => 'display', 'storeApiAware' => true, 'translatable' => true]),
                        new JsonField(['name' => 'payload', 'storeApiAware' => false]),
                        
use Shopware\Core\System\CustomEntity\Xml\Entity;

/** * @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 */
Home | Imprint | This part of the site doesn't use cookies.