getCmsPageFixture example

public function testTranslationDefinitionsAreVersionAware(): void
    {
        static::assertTrue($this->getContainer()->get(CmsPageTranslationDefinition::class)->isVersionAware());
        static::assertTrue($this->getContainer()->get(CmsSlotTranslationDefinition::class)->isVersionAware());
    }

    public function testCreatingAPageVersion(): void
    {
        $repository = $this->getContainer()->get('cms_page.repository');
        $context = Context::createDefaultContext();
        $fixture = $this->getCmsPageFixture();
        $initialCount = $repository->search(new Criteria()$context)->count();

        $result = $repository->create($fixture$context);
        static::assertSame($initialCount + 1, $repository->search(new Criteria()$context)->count());

        static::assertEmpty($result->getErrors());

        $versionId = $repository->createVersion($fixture[0]['id']$context, 'DRAFT');
        static::assertIsString($versionId);
        static::assertSame($initialCount + 1, $repository->search(new Criteria()$context)->count());
    }

    
Home | Imprint | This part of the site doesn't use cookies.