diff --git a/tests/Functional/Api/BlockTest.php b/tests/Functional/Api/BlockTest.php new file mode 100644 index 000000000..302ba9a0d --- /dev/null +++ b/tests/Functional/Api/BlockTest.php @@ -0,0 +1,53 @@ + 'application/ld+json', 'HTTP_ACCEPT' => 'application/ld+json']; + + public function setUp(): void + { + $this->loadFixturesFromFile('Api/BlockTest/block.yml'); + } + + public function test_block_response(): void + { + /** @var BlockInterface $block */ + $block = $this->getRepository()->findEnabledByCode('block1-code', 'code'); + $this->client->request('GET', '/api/v2/shop/cms-plugin/blocks/' . $block->getId(), [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/BlockTest/test_it_get_block_by_id', Response::HTTP_OK); + } + + public function test_blocks_response(): void + { + $this->client->request('GET', '/api/v2/shop/cms-plugin/blocks', [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/BlockTest/test_it_get_blocks', Response::HTTP_OK); + } + + private function getRepository(): BlockRepositoryInterface + { + /** @var BlockRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(BlockInterface::class); + + return $repository; + } +} diff --git a/tests/Functional/Api/FrequentlyAskedQuestionTest.php b/tests/Functional/Api/FrequentlyAskedQuestionTest.php new file mode 100644 index 000000000..a4ff6b3e7 --- /dev/null +++ b/tests/Functional/Api/FrequentlyAskedQuestionTest.php @@ -0,0 +1,52 @@ + 'application/ld+json', 'HTTP_ACCEPT' => 'application/ld+json']; + + public function setUp(): void + { + $this->loadFixturesFromFile('Api/FrequentlyAskedQuestionTest/frequently_asked_question.yml'); + } + + public function test_block_response(): void + { + /** @var FrequentlyAskedQuestionInterface $faq */ + $faq = $this->getRepository()->findOneEnabledByCode('faq1-code'); + $this->client->request('GET', '/api/v2/shop/cms-plugin/faq/' . $faq->getId(), [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/FrequentlyAskedQuestionTest/test_it_get_frequently_asked_question_by_id', Response::HTTP_OK); + } + +// public function test_blocks_response(): void{ +// $this->client->request('GET', '/api/v2/shop/cms-plugin/faq', [], [], self::CONTENT_TYPE_HEADER); +// $response = $this->client->getResponse(); +// +// $this->assertResponse($response, 'Api/BlockTest/test_it_get_blocks', Response::HTTP_OK); +// } + + private function getRepository(): FrequentlyAskedQuestionRepositoryInterface + { + /** @var FrequentlyAskedQuestionRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(FrequentlyAskedQuestionInterface::class); + + return $repository; + } +} diff --git a/tests/Functional/Api/MediaTest.php b/tests/Functional/Api/MediaTest.php new file mode 100644 index 000000000..e235d4d7d --- /dev/null +++ b/tests/Functional/Api/MediaTest.php @@ -0,0 +1,54 @@ + 'application/ld+json', 'HTTP_ACCEPT' => 'application/ld+json']; + + public function setUp(): void + { + $this->loadFixturesFromFile('Api/MediaTest/media.yml'); + } + + public function test_media_response(): void + { + /** @var MediaInterface $media */ + $media = $this->getRepository()->findOneEnabledByCode('media1-code', 'en_US', 'code'); + + $this->client->request('GET', '/api/v2/shop/cms-plugin/media/' . $media->getId(), [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/MediaTest/test_it_get_media_by_id', Response::HTTP_OK); + } + + public function test_medias_response(): void + { + $this->client->request('GET', '/api/v2/shop/cms-plugin/media', [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/MediaTest/test_it_get_media', Response::HTTP_OK); + } + + private function getRepository(): MediaRepositoryInterface + { + /** @var MediaRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(MediaInterface::class); + + return $repository; + } +} diff --git a/tests/Functional/Api/PageTest.php b/tests/Functional/Api/PageTest.php new file mode 100644 index 000000000..670982b00 --- /dev/null +++ b/tests/Functional/Api/PageTest.php @@ -0,0 +1,53 @@ + 'application/ld+json', 'HTTP_ACCEPT' => 'application/ld+json']; + + public function setUp(): void + { + $this->loadFixturesFromFile('Api/PageTest/page.yml'); + } + + public function test_page_response(): void + { + /** @var PageInterface $page */ + $page = $this->getRepository()->findOneEnabledByCode('page1-code', 'en_US'); + $this->client->request('GET', '/api/v2/shop/cms-plugin/pages/' . $page->getId(), [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/PageTest/test_it_get_page_by_id', Response::HTTP_OK); + } + + public function test_pages_response(): void + { + $this->client->request('GET', '/api/v2/shop/cms-plugin/pages', [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/PageTest/test_it_get_pages', Response::HTTP_OK); + } + + private function getRepository(): PageRepositoryInterface + { + /** @var PageRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(PageInterface::class); + + return $repository; + } +} diff --git a/tests/Functional/Api/SectionTest.php b/tests/Functional/Api/SectionTest.php new file mode 100644 index 000000000..f68e6677d --- /dev/null +++ b/tests/Functional/Api/SectionTest.php @@ -0,0 +1,53 @@ + 'application/ld+json', 'HTTP_ACCEPT' => 'application/ld+json']; + + public function setUp(): void + { + $this->loadFixturesFromFile('Api/SectionTest/section.yml'); + } + + public function test_section_response(): void + { + /** @var SectionInterface $section */ + $section = $this->getRepository()->findOneByCode('section1-code', 'en_US'); + $this->client->request('GET', '/api/v2/shop/cms-plugin/sections/' . $section->getId(), [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/SectionTest/test_it_get_section_by_id', Response::HTTP_OK); + } + + public function test_sections_response(): void + { + $this->client->request('GET', '/api/v2/shop/cms-plugin/sections', [], [], self::CONTENT_TYPE_HEADER); + $response = $this->client->getResponse(); + + $this->assertResponse($response, 'Api/SectionTest/test_it_get_sections', Response::HTTP_OK); + } + + private function getRepository(): SectionRepositoryInterface + { + /** @var SectionRepositoryInterface $repository */ + $repository = $this->getEntityManager()->getRepository(SectionInterface::class); + + return $repository; + } +} diff --git a/tests/Functional/DataFixtures/ORM/Api/BlockTest/block.yml b/tests/Functional/DataFixtures/ORM/Api/BlockTest/block.yml new file mode 100644 index 000000000..8fe7d1a68 --- /dev/null +++ b/tests/Functional/DataFixtures/ORM/Api/BlockTest/block.yml @@ -0,0 +1,134 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +Sylius\Component\Taxonomy\Model\TaxonTranslation: + taxon_translation: + locale: 'en_US' + name: "taxon-trans" + slug: "taxon-slug" +Sylius\Component\Core\Model\Taxon: + taxon: + code: "menu_category" + translations: + - '@taxon_translation' + enabled: true +Sylius\Component\Core\Model\ProductTranslation: + first_product_US_translation: + name: 'test_name1' + slug: 'test_slug1' + locale: 'en_US' + second_product_US_translation: + name: 'test_name2' + slug: 'test_slug2' + locale: 'en_US' + third_product_US_translation: + name: 'test_name3' + slug: 'test_slug3' + locale: 'en_US' +Sylius\Component\Core\Model\Product: + product1: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW" + translations: + - "@first_product_US_translation" + product2: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW2" + translations: + - "@second_product_US_translation" + product3: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW3" + translations: + - "@third_product_US_translation" +Sylius\Component\Core\Model\ProductTaxon: + first_relation: + taxon: '@taxon' + product: '@product1' + second_relation: + taxon: '@taxon' + product: '@product2' +Sylius\Component\Core\Model\ProductVariant: + product_variant1: + product: '@product1' + code: "code1" + +BitBag\SyliusCmsPlugin\Entity\BlockTranslation: + block1_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + link: 'translation_link_en_US' + block2_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + link: 'translation_link_en_US' + block3_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + link: 'translation_link_en_US' +BitBag\SyliusCmsPlugin\Entity\Block: + block1: + code: 'block1-code' + enabled: true + products: + - '@product1' + sections: + - '@section1' + channels: + - '@channel' + translations: + - '@block1_translation' + taxons: + - '@taxon' + block2: + code: 'block2-code' + enabled: true + products: + - '@product2' + sections: + - '@section2' + channels: + - '@channel' + translations: + - '@block2_translation' + block3: + code: 'block3-code' + enabled: false + products: + - '@product3' + sections: + - '@section3' + channels: + - '@channel' + translations: + - '@block3_translation' +BitBag\SyliusCmsPlugin\Entity\Section: + section1: + code: 'section1-code' + section2: + code: 'section2-code' + section3: + code: 'section3-code' + diff --git a/tests/Functional/DataFixtures/ORM/Api/FrequentlyAskedQuestionTest/frequently_asked_question.yml b/tests/Functional/DataFixtures/ORM/Api/FrequentlyAskedQuestionTest/frequently_asked_question.yml new file mode 100644 index 000000000..8394f9189 --- /dev/null +++ b/tests/Functional/DataFixtures/ORM/Api/FrequentlyAskedQuestionTest/frequently_asked_question.yml @@ -0,0 +1,57 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestionTranslation: + frequently_asked_question1_translation: + question: "How many days there are in one year?" + answer: "It may vary depending on whether you are working on a new question" + locale: 'en_US' + frequently_asked_question2_translation: + question: "Who is responsible for the translation" + answer: "Translators are" + locale: 'en_US' + frequently_asked_question3_translation: + question: "What is the date?" + answer: "Dunno" + locale: 'en_US' +BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestion: + frequently_asked_question1: + code: 'faq1-code' + enabled: true + position: 10 + channels: + - '@channel' + translations: + - '@frequently_asked_question1_translation' + frequently_asked_question2: + code: 'faq2-code' + enabled: true + position: 20 + channels: + - '@channel' + translations: + - '@frequently_asked_question2_translation' + frequently_asked_question3: + code: 'faq3-code' + enabled: false + position: 30 + channels: + - '@channel' + translations: + - '@frequently_asked_question3_translation' diff --git a/tests/Functional/DataFixtures/ORM/Api/MediaTest/media.yml b/tests/Functional/DataFixtures/ORM/Api/MediaTest/media.yml new file mode 100644 index 000000000..119becddf --- /dev/null +++ b/tests/Functional/DataFixtures/ORM/Api/MediaTest/media.yml @@ -0,0 +1,138 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +Sylius\Component\Taxonomy\Model\TaxonTranslation: + taxon_translation: + locale: 'en_US' + name: "taxon-trans" + slug: "taxon-slug" +Sylius\Component\Core\Model\Taxon: + taxon: + code: "menu_category" + translations: + - '@taxon_translation' + enabled: true +Sylius\Component\Core\Model\ProductTranslation: + first_product_US_translation: + name: 'test_name1' + slug: 'test_slug1' + locale: 'en_US' + second_product_US_translation: + name: 'test_name2' + slug: 'test_slug2' + locale: 'en_US' + third_product_US_translation: + name: 'test_name3' + slug: 'test_slug3' + locale: 'en_US' +Sylius\Component\Core\Model\Product: + product1: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW" + translations: + - "@first_product_US_translation" + product2: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW2" + translations: + - "@second_product_US_translation" + product3: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW3" + translations: + - "@third_product_US_translation" +Sylius\Component\Core\Model\ProductTaxon: + first_relation: + taxon: '@taxon' + product: '@product1' + second_relation: + taxon: '@taxon' + product: '@product2' +Sylius\Component\Core\Model\ProductVariant: + product_variant1: + product: '@product1' + code: "code1" + +BitBag\SyliusCmsPlugin\Entity\MediaTranslation: + media1_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + link: 'translation_link_en_US' + media2_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + link: 'translation_link_en_US' + media3_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + link: 'translation_link_en_US' +BitBag\SyliusCmsPlugin\Entity\Media: + media1: + code: 'media1-code' + enabled: true + type: 'image' + path: '/path/to/media1' + products: + - '@product1' + sections: + - '@section1' + channels: + - '@channel' + translations: + - '@media1_translation' + media2: + code: 'media2-code' + enabled: true + type: 'image' + path: '/path/to/media2' + products: + - '@product2' + sections: + - '@section2' + channels: + - '@channel' + translations: + - '@media2_translation' + media3: + code: 'media3-code' + enabled: false + type: 'image' + path: '/path/to/media3' + products: + - '@product3' + sections: + - '@section3' + channels: + - '@channel' + translations: + - '@media3_translation' +BitBag\SyliusCmsPlugin\Entity\Section: + section1: + code: 'section1-code' + section2: + code: 'section2-code' + section3: + code: 'section3-code' + diff --git a/tests/Functional/DataFixtures/ORM/Api/PageTest/page.yml b/tests/Functional/DataFixtures/ORM/Api/PageTest/page.yml new file mode 100644 index 000000000..a2778e2a8 --- /dev/null +++ b/tests/Functional/DataFixtures/ORM/Api/PageTest/page.yml @@ -0,0 +1,141 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +Sylius\Component\Taxonomy\Model\TaxonTranslation: + taxon_translation: + locale: 'en_US' + name: "taxon-trans" + slug: "taxon-slug" +Sylius\Component\Core\Model\Taxon: + taxon: + code: "menu_category" + translations: + - '@taxon_translation' + enabled: true +Sylius\Component\Core\Model\ProductTranslation: + first_product_US_translation: + name: 'test_name1' + slug: 'test_slug1' + locale: 'en_US' + second_product_US_translation: + name: 'test_name2' + slug: 'test_slug2' + locale: 'en_US' + third_product_US_translation: + name: 'test_name3' + slug: 'test_slug3' + locale: 'en_US' +Sylius\Component\Core\Model\Product: + product1: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW" + translations: + - "@first_product_US_translation" + product2: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW2" + translations: + - "@second_product_US_translation" + product3: + fallbackLocale: "en_US" + currentLocale: "en_US" + code: "MUG_SW3" + translations: + - "@third_product_US_translation" +Sylius\Component\Core\Model\ProductTaxon: + first_relation: + taxon: '@taxon' + product: '@product1' + second_relation: + taxon: '@taxon' + product: '@product2' +Sylius\Component\Core\Model\ProductVariant: + product_variant1: + product: '@product1' + code: "code1" + +BitBag\SyliusCmsPlugin\Entity\PageTranslation: + page1_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + slug: 'translation1_slug_en_US' + metaKeywords: 'html,application' + breadcrumb: '/application/translations_1' + title: 'Amazing article1' + page2_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + slug: 'translation2_slug_en_US' + metaKeywords: 'html,application' + breadcrumb: '/application/translations_2' + title: 'Amazing article2' + page3_translation: + name: 'translation_name_en_US' + locale: 'en_US' + content: 'translation_content_en_US' + slug: 'translation3_slug_en_US' + metaKeywords: 'html,application' + breadcrumb: '/application/translations_3' + title: 'Amazing article3' +BitBag\SyliusCmsPlugin\Entity\Page: + page1: + code: 'page1-code' + enabled: true + products: + - '@product1' + sections: + - '@section1' + channels: + - '@channel' + translations: + - '@page1_translation' + page2: + code: 'page2-code' + enabled: true + products: + - '@product2' + sections: + - '@section2' + channels: + - '@channel' + translations: + - '@page2_translation' + page3: + code: 'page3-code' + enabled: false + products: + - '@product3' + sections: + - '@section3' + channels: + - '@channel' + translations: + - '@page3_translation' +BitBag\SyliusCmsPlugin\Entity\Section: + section1: + code: 'section1-code' + section2: + code: 'section2-code' + section3: + code: 'section3-code' + diff --git a/tests/Functional/DataFixtures/ORM/Api/SectionTest/section.yml b/tests/Functional/DataFixtures/ORM/Api/SectionTest/section.yml new file mode 100644 index 000000000..de388d554 --- /dev/null +++ b/tests/Functional/DataFixtures/ORM/Api/SectionTest/section.yml @@ -0,0 +1,42 @@ +Sylius\Component\Addressing\Model\Country: + USA: + code: 'US' +Sylius\Component\Currency\Model\Currency: + dollar: + code: 'USD' +Sylius\Component\Locale\Model\Locale: + locale: + createdAt: '' + code: 'en_US' +Sylius\Component\Core\Model\Channel: + channel: + code: "code" + name: "name" + locales: + - '@locale' + default_locale: '@locale' + tax_calculation_strategy: 'order_items_based' + base_currency: '@dollar' +BitBag\SyliusCmsPlugin\Entity\SectionTranslation: + section1_translation: + name: 'translation1_name_en_US' + locale: 'en_US' + section2_translation: + name: 'translation2_name_en_US' + locale: 'en_US' + section3_translation: + name: 'translation3_name_en_US' + locale: 'en_US' +BitBag\SyliusCmsPlugin\Entity\Section: + section1: + code: 'section1-code' + translations: + - '@section1_translation' + section2: + code: 'section2-code' + translations: + - '@section2_translation' + section3: + code: 'section3-code' + translations: + - '@section3_translation' diff --git a/tests/Functional/FunctionalTestCase.php b/tests/Functional/FunctionalTestCase.php new file mode 100644 index 000000000..a1d25b996 --- /dev/null +++ b/tests/Functional/FunctionalTestCase.php @@ -0,0 +1,36 @@ +dataFixturesPath = __DIR__ . \DIRECTORY_SEPARATOR . 'DataFixtures' . \DIRECTORY_SEPARATOR . 'ORM'; + $this->expectedResponsesPath = __DIR__ . \DIRECTORY_SEPARATOR . 'Responses' . \DIRECTORY_SEPARATOR . 'Expected'; + $this->filesPath = __DIR__ . \DIRECTORY_SEPARATOR . 'Resources' . \DIRECTORY_SEPARATOR . 'files'; + } + + public function getFilePath(string $fileName): string + { + return $this->filesPath . \DIRECTORY_SEPARATOR . $fileName; + } +} diff --git a/tests/Functional/Responses/Expected/Api/BlockTest/test_it_get_block_by_id.json b/tests/Functional/Responses/Expected/Api/BlockTest/test_it_get_block_by_id.json new file mode 100644 index 000000000..71e6a0e79 --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/BlockTest/test_it_get_block_by_id.json @@ -0,0 +1,36 @@ +{ + "@context": "/api/v2/contexts/Block", + "@id": "/api/v2/shop/cms-plugin/blocks/@integer@", + "@type": "Block", + "id": "@integer@", + "code": "block1-code", + "enabled": true, + "sections": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section1-code" + } + ], + "products": [ + "/api/v2/shop/products/MUG_SW" + ], + "channels": [ + "/api/v2/shop/channels/code" + ], + "translations": { + "en_US": { + "@type": "BlockTranslation", + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "link": "translation_link_en_US" + } + }, + "taxons": [ + { + "@id": "/api/v2/shop/taxons/menu_category", + "@type": "Taxon" + } + ] +} diff --git a/tests/Functional/Responses/Expected/Api/BlockTest/test_it_get_blocks.json b/tests/Functional/Responses/Expected/Api/BlockTest/test_it_get_blocks.json new file mode 100644 index 000000000..12067ef32 --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/BlockTest/test_it_get_blocks.json @@ -0,0 +1,103 @@ +{ + "@context": "/api/v2/contexts/Block", + "@id": "/api/v2/shop/cms-plugin/blocks", + "@type": "hydra:Collection", + "hydra:member": [ + { + "@id": "/api/v2/shop/cms-plugin/blocks/@integer@", + "@type": "Block", + "id": "@integer@", + "code": "block1-code", + "enabled": true, + "sections": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section1-code" + } + ], + "products": [ + "/api/v2/shop/products/MUG_SW" + ], + "channels": [ + "/api/v2/shop/channels/code" + ], + "translations": { + "en_US": { + "@type": "BlockTranslation", + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "link": "translation_link_en_US" + } + }, + "taxons": [ + { + "@id": "/api/v2/shop/taxons/menu_category", + "@type": "Taxon" + } + ] + }, + { + "@id": "/api/v2/shop/cms-plugin/blocks/@integer@", + "@type": "Block", + "id": "@integer@", + "code": "block2-code", + "enabled": true, + "sections": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section2-code" + } + ], + "products": [ + "/api/v2/shop/products/MUG_SW2" + ], + "channels": [ + "/api/v2/shop/channels/code" + ], + "translations": { + "en_US": { + "@type": "BlockTranslation", + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "link": "translation_link_en_US" + } + }, + "taxons": [] + }, + { + "@id": "/api/v2/shop/cms-plugin/blocks/@integer@", + "@type": "Block", + "id": "@integer@", + "code": "block3-code", + "enabled": false, + "sections": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section3-code" + } + ], + "products": [ + "/api/v2/shop/products/MUG_SW3" + ], + "channels": [ + "/api/v2/shop/channels/code" + ], + "translations": { + "en_US": { + "@type": "BlockTranslation", + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "link": "translation_link_en_US" + } + }, + "taxons": [] + } + ], + "hydra:totalItems": 3 +} diff --git a/tests/Functional/Responses/Expected/Api/FrequentlyAskedQuestionTest/test_it_get_frequently_asked_question_by_id.json b/tests/Functional/Responses/Expected/Api/FrequentlyAskedQuestionTest/test_it_get_frequently_asked_question_by_id.json new file mode 100644 index 000000000..9f732eff1 --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/FrequentlyAskedQuestionTest/test_it_get_frequently_asked_question_by_id.json @@ -0,0 +1,19 @@ +{ + "@context": "/api/v2/contexts/FrequentlyAskedQuestion", + "@id": "/api/v2/shop/cms-plugin/faq/@integer@", + "@type": "FrequentlyAskedQuestion", + "id": "@integer@", + "code": "faq1-code", + "position": 10, + "channels": [ + "/api/v2/shop/channels/code" + ], + "enabled": true, + "translations": { + "en_US": { + "@type": "FrequentlyAskedQuestionTranslation", + "question": "How many days there are in one year?", + "answer": "It may vary depending on whether you are working on a new question" + } + } +} diff --git a/tests/Functional/Responses/Expected/Api/FrequentlyAskedQuestionTest/test_it_get_frequently_asked_questions.json b/tests/Functional/Responses/Expected/Api/FrequentlyAskedQuestionTest/test_it_get_frequently_asked_questions.json new file mode 100644 index 000000000..65fab508c --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/FrequentlyAskedQuestionTest/test_it_get_frequently_asked_questions.json @@ -0,0 +1,62 @@ +{ + "@context": "/api/v2/contexts/FrequentlyAskedQuestion", + "@id": "/api/v2/shop/cms-plugin/faq", + "@type": "hydra:Collection", + "hydra:member": [ + { + "@id": "/api/v2/shop/cms-plugin/faq/@integer@", + "@type": "FrequentlyAskedQuestion", + "id": "@integer@", + "code": "faq1-code", + "position": 10, + "channels": [ + "/api/v2/shop/channels/code" + ], + "enabled": true, + "translations": { + "en_US": { + "@type": "FrequentlyAskedQuestionTranslation", + "question": "How many days there are in one year?", + "answer": "It may vary depending on whether you are working on a new question" + } + } + }, + { + "@id": "/api/v2/shop/cms-plugin/faq/@integer@", + "@type": "FrequentlyAskedQuestion", + "id": "@integer@", + "code": "faq2-code", + "position": 20, + "channels": [ + "/api/v2/shop/channels/code" + ], + "enabled": true, + "translations": { + "en_US": { + "@type": "FrequentlyAskedQuestionTranslation", + "question": "Who is responsible for the translation", + "answer": "Translators are" + } + } + }, + { + "@id": "/api/v2/shop/cms-plugin/faq/@integer@", + "@type": "FrequentlyAskedQuestion", + "id": "@integer@", + "code": "faq3-code", + "position": 30, + "channels": [ + "/api/v2/shop/channels/code" + ], + "enabled": false, + "translations": { + "en_US": { + "@type": "FrequentlyAskedQuestionTranslation", + "question": "What is the date?", + "answer": "Dunno" + } + } + } + ], + "hydra:totalItems": 3 +} diff --git a/tests/Functional/Responses/Expected/Api/MediaTest/test_it_get_media.json b/tests/Functional/Responses/Expected/Api/MediaTest/test_it_get_media.json new file mode 100644 index 000000000..59ebcc373 --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/MediaTest/test_it_get_media.json @@ -0,0 +1,116 @@ +{ + "@context": "/api/v2/contexts/Media", + "@id": "/api/v2/shop/cms-plugin/media", + "@type": "hydra:Collection", + "hydra:member": [ + { + "@id": "/api/v2/shop/cms-plugin/media/@integer@", + "@type": "Media", + "id": "@integer@", + "type": "image", + "code": "media1-code", + "path": "/path/to/media1", + "mimeType": null, + "width": null, + "height": null, + "saveWithOriginalName": false, + "enabled": true, + "sections": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section1-code" + } + ], + "products": [ + "/api/v2/shop/products/MUG_SW" + ], + "channels": [ + "/api/v2/shop/channels/code" + ], + "translations": { + "en_US": { + "@type": "MediaTranslation", + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "alt": null, + "link": "translation_link_en_US" + } + } + }, + { + "@id": "/api/v2/shop/cms-plugin/media/@integer@", + "@type": "Media", + "id": "@integer@", + "type": "image", + "code": "media2-code", + "path": "/path/to/media2", + "mimeType": null, + "width": null, + "height": null, + "saveWithOriginalName": false, + "enabled": true, + "sections": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section2-code" + } + ], + "products": [ + "/api/v2/shop/products/MUG_SW2" + ], + "channels": [ + "/api/v2/shop/channels/code" + ], + "translations": { + "en_US": { + "@type": "MediaTranslation", + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "alt": null, + "link": "translation_link_en_US" + } + } + }, + { + "@id": "/api/v2/shop/cms-plugin/media/@integer@", + "@type": "Media", + "id": "@integer@", + "type": "image", + "code": "media3-code", + "path": "/path/to/media3", + "mimeType": null, + "width": null, + "height": null, + "saveWithOriginalName": false, + "enabled": false, + "sections": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section3-code" + } + ], + "products": [ + "/api/v2/shop/products/MUG_SW3" + ], + "channels": [ + "/api/v2/shop/channels/code" + ], + "translations": { + "en_US": { + "@type": "MediaTranslation", + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "alt": null, + "link": "translation_link_en_US" + } + } + } + ], + "hydra:totalItems": 3 +} diff --git a/tests/Functional/Responses/Expected/Api/MediaTest/test_it_get_media_by_id.json b/tests/Functional/Responses/Expected/Api/MediaTest/test_it_get_media_by_id.json new file mode 100644 index 000000000..e72cc1fb6 --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/MediaTest/test_it_get_media_by_id.json @@ -0,0 +1,37 @@ +{ + "@context": "/api/v2/contexts/Media", + "@id": "/api/v2/shop/cms-plugin/media/@integer@", + "@type": "Media", + "id": "@integer@", + "type": "image", + "code": "media1-code", + "path": "/path/to/media1", + "mimeType": null, + "width": null, + "height": null, + "saveWithOriginalName": false, + "enabled": true, + "sections": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section1-code" + } + ], + "products": [ + "/api/v2/shop/products/MUG_SW" + ], + "channels": [ + "/api/v2/shop/channels/code" + ], + "translations": { + "en_US": { + "@type": "MediaTranslation", + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "alt": null, + "link": "translation_link_en_US" + } + } +} diff --git a/tests/Functional/Responses/Expected/Api/PageTest/test_it_get_page_by_id.json b/tests/Functional/Responses/Expected/Api/PageTest/test_it_get_page_by_id.json new file mode 100644 index 000000000..b30d87a5b --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/PageTest/test_it_get_page_by_id.json @@ -0,0 +1,24 @@ +{ + "@context": "/api/v2/contexts/Page", + "@id": "/api/v2/shop/cms-plugin/pages/@integer@", + "@type": "Page", + "id": "@integer@", + "code": "page1-code", + "publishAt": null, + "translations": { + "en_US": { + "@type": "PageTranslation", + "id": "@integer@", + "slug": "translation1_slug_en_US", + "image": null, + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "metaKeywords": "html,application", + "metaDescription": null, + "nameWhenLinked": null, + "descriptionWhenLinked": null, + "breadcrumb": "/application/translations_1", + "title": "Amazing article1" + } + } +} diff --git a/tests/Functional/Responses/Expected/Api/PageTest/test_it_get_pages.json b/tests/Functional/Responses/Expected/Api/PageTest/test_it_get_pages.json new file mode 100644 index 000000000..e8e25fda5 --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/PageTest/test_it_get_pages.json @@ -0,0 +1,77 @@ +{ + "@context": "/api/v2/contexts/Page", + "@id": "/api/v2/shop/cms-plugin/pages", + "@type": "hydra:Collection", + "hydra:member": [ + { + "@id": "/api/v2/shop/cms-plugin/pages/@integer@", + "@type": "Page", + "id": "@integer@", + "code": "page1-code", + "publishAt": null, + "translations": { + "en_US": { + "@type": "PageTranslation", + "id": "@integer@", + "slug": "translation1_slug_en_US", + "image": null, + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "metaKeywords": "html,application", + "metaDescription": null, + "nameWhenLinked": null, + "descriptionWhenLinked": null, + "breadcrumb": "/application/translations_1", + "title": "Amazing article1" + } + } + }, + { + "@id": "/api/v2/shop/cms-plugin/pages/@integer@", + "@type": "Page", + "id": "@integer@", + "code": "page2-code", + "publishAt": null, + "translations": { + "en_US": { + "@type": "PageTranslation", + "id": "@integer@", + "slug": "translation2_slug_en_US", + "image": null, + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "metaKeywords": "html,application", + "metaDescription": null, + "nameWhenLinked": null, + "descriptionWhenLinked": null, + "breadcrumb": "/application/translations_2", + "title": "Amazing article2" + } + } + }, + { + "@id": "/api/v2/shop/cms-plugin/pages/@integer@", + "@type": "Page", + "id": "@integer@", + "code": "page3-code", + "publishAt": null, + "translations": { + "en_US": { + "@type": "PageTranslation", + "id": "@integer@", + "slug": "translation3_slug_en_US", + "image": null, + "name": "translation_name_en_US", + "content": "translation_content_en_US", + "metaKeywords": "html,application", + "metaDescription": null, + "nameWhenLinked": null, + "descriptionWhenLinked": null, + "breadcrumb": "/application/translations_3", + "title": "Amazing article3" + } + } + } + ], + "hydra:totalItems": 3 +} diff --git a/tests/Functional/Responses/Expected/Api/SectionTest/test_it_get_section_by_id.json b/tests/Functional/Responses/Expected/Api/SectionTest/test_it_get_section_by_id.json new file mode 100644 index 000000000..ea79e6526 --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/SectionTest/test_it_get_section_by_id.json @@ -0,0 +1,7 @@ +{ + "@context": "/api/v2/contexts/Section", + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section1-code" +} diff --git a/tests/Functional/Responses/Expected/Api/SectionTest/test_it_get_sections.json b/tests/Functional/Responses/Expected/Api/SectionTest/test_it_get_sections.json new file mode 100644 index 000000000..1e2715f58 --- /dev/null +++ b/tests/Functional/Responses/Expected/Api/SectionTest/test_it_get_sections.json @@ -0,0 +1,26 @@ +{ + "@context": "/api/v2/contexts/Section", + "@id": "/api/v2/shop/cms-plugin/sections", + "@type": "hydra:Collection", + "hydra:member": [ + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section1-code" + }, + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section2-code" + }, + { + "@id": "/api/v2/shop/cms-plugin/sections/@integer@", + "@type": "Section", + "id": "@integer@", + "code": "section3-code" + } + ], + "hydra:totalItems": 3 +}