From 4214d0853f9363fa88b200b9d6f6d96da8794042 Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza Date: Fri, 7 Sep 2018 16:24:54 +0200 Subject: [PATCH] Integration test for swatches types in attribute configuration added --- .../AddSwatchAttributeTypeObserverTest.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Swatches/Observer/AddSwatchAttributeTypeObserverTest.php diff --git a/dev/tests/integration/testsuite/Magento/Swatches/Observer/AddSwatchAttributeTypeObserverTest.php b/dev/tests/integration/testsuite/Magento/Swatches/Observer/AddSwatchAttributeTypeObserverTest.php new file mode 100644 index 0000000000000..15d10c2ddffd4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Swatches/Observer/AddSwatchAttributeTypeObserverTest.php @@ -0,0 +1,48 @@ +get(ManagerInterface::class); + $response = new DataObject(); + $response->setTypes([]); + + $eventManager->dispatch( + 'adminhtml_product_attribute_types', + ['response' => $response] + ); + + $responseTypes = $response->getTypes(); + + self::assertGreaterThan(0, count($responseTypes)); + + /* Iterate through values since other types (not swatches) might be added by observers */ + $responseTypeValues = []; + foreach ($responseTypes as $responseType) { + $responseTypeValues[] = $responseType['value']; + } + + self::assertTrue(in_array(Swatch::SWATCH_TYPE_VISUAL_ATTRIBUTE_FRONTEND_INPUT, $responseTypeValues)); + self::assertTrue(in_array(Swatch::SWATCH_TYPE_TEXTUAL_ATTRIBUTE_FRONTEND_INPUT, $responseTypeValues)); + } +}