assertConfigurationIsValid([[]], 'custom'); } /** * @test */ public function custom_enabled_is_optional_but_must_be_boolean(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'enabled' => true, ], ], ], ], 'custom.*.enabled'); $this->assertPartialConfigurationIsInvalid([ [ 'custom' => [ 'page_1' => [ 'enabled' => 'boolean', ], ], ], ], 'custom.*.enabled'); } /** * @test */ public function custom_translations_is_optional_but_must_be_array(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [], ], ], ], ], 'custom.*.translations'); $this->assertPartialConfigurationIsInvalid([ [ 'custom' => [ 'page_1' => [ 'translations' => 'array', ], ], ], ], 'custom.*.translations'); } /** * @test */ public function custom_may_contain_slug(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'slug' => 'my-page', ], ], ], ], ], ], 'custom.*.translations.*.slug'); $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'slug' => '', ], ], ], ], ], ], 'custom.*.translations.*.slug'); } /** * @test */ public function custom_may_contain_name(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'name' => 'My page', ], ], ], ], ], ], 'custom.*.translations.*.name'); $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'name' => '', ], ], ], ], ], ], 'custom.*.translations.*.name'); } /** * @test */ public function custom_may_contain_meta_keywords(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'meta_keywords' => 'page', ], ], ], ], ], ], 'custom.*.translations.*.meta_keywords'); $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'meta_keywords' => '', ], ], ], ], ], ], 'custom.*.translations.*.meta_keywords'); } /** * @test */ public function custom_may_contain_meta_description(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'meta_description' => 'My page', ], ], ], ], ], ], 'custom.*.translations.*.meta_description'); $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'meta_description' => 'My page', ], ], ], ], ], ], 'custom.*.translations.*.meta_description'); } /** * @test */ public function custom_may_contain_content(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'content' => 'My page', ], ], ], ], ], ], 'custom.*.translations.*.content'); $this->assertConfigurationIsValid([ [ 'custom' => [ 'page_1' => [ 'translations' => [ 'en_US' => [ 'content' => 'My page', ], ], ], ], ], ], 'custom.*.translations.*.content'); } /** * @test */ public function custom_number_is_optional_but_must_be_integer(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'homepage_banner' => [ 'number' => 1, ], ], ], ], 'custom.*.number'); $this->assertPartialConfigurationIsInvalid([ [ 'custom' => [ 'homepage_banner' => [ 'number' => '1', ], ], ], ], 'custom.*.number'); } /** * @test */ public function custom_remove_existing_is_optional_but_must_be_boolean(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'homepage_banner' => [ 'remove_existing' => true, ], ], ], ], 'custom.*.remove_existing'); $this->assertPartialConfigurationIsInvalid([ [ 'custom' => [ 'homepage_banner' => [ 'remove_existing' => 'boolean', ], ], ], ], 'custom.*.remove_existing'); } /** * @test */ public function custom_sections_is_optional_but_must_be_scalar_array(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'homepage_banner' => [ 'sections' => ['blog', 'homepage'], ], ], ], ], 'custom.*.sections'); $this->assertConfigurationIsValid([ [ 'custom' => [ 'homepage_banner' => [ 'sections' => [], ], ], ], ], 'custom.*.sections'); $this->assertPartialConfigurationIsInvalid([ [ 'custom' => [ 'custom_1' => [ 'sections' => '', ], ], ], ], 'custom.*.sections'); $this->assertPartialConfigurationIsInvalid([ [ 'custom' => [ 'custom_1' => [ 'section_name' => 'blog', ], ], ], ], 'custom.*.sections'); } /** * @test */ public function custom_products_is_optional_but_must_be_integer(): void { $this->assertConfigurationIsValid([ [ 'custom' => [ 'homepage_banner' => [ 'products' => 5, ], ], ], ], 'custom.*.products'); $this->assertPartialConfigurationIsInvalid([ [ 'custom' => [ 'homepage_banner' => [ 'enabled' => 'integer', ], ], ], ], 'custom.*.products'); } protected function getConfiguration(): PageFixture { /** @var FixtureFactoryInterface $pageFixtureFactory */ $pageFixtureFactory = $this->getMockBuilder(FixtureFactoryInterface::class)->getMock(); return new PageFixture($pageFixtureFactory); } }