diff --git a/app/code/Magento/CmsUrlRewrite/etc/adminhtml/di.xml b/app/code/Magento/CmsUrlRewrite/etc/di.xml similarity index 100% rename from app/code/Magento/CmsUrlRewrite/etc/adminhtml/di.xml rename to app/code/Magento/CmsUrlRewrite/etc/di.xml diff --git a/dev/tests/api-functional/testsuite/Magento/Cms/Api/PageRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Cms/Api/PageRepositoryTest.php index f458fb208fe85..5bf5520ce344b 100644 --- a/dev/tests/api-functional/testsuite/Magento/Cms/Api/PageRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Cms/Api/PageRepositoryTest.php @@ -249,4 +249,67 @@ public function testSearch() $this->assertEquals(1, $searchResult['total_count']); $this->assertEquals($searchResult['items'][0][PageInterface::IDENTIFIER], $pageIdentifier); } + + /** + * Create page with the same identifier after one was removed. + */ + public function testCreateSamePage() + { + $pageIdentifier = 'page-' . uniqid(); + + $pageId = $this->createPageWithIdentifier($pageIdentifier); + $this->deletePageByIdentifier($pageId); + $this->createPageWithIdentifier($pageIdentifier); + } + + /** + * Create page with hard-coded identifier to test with create-delete-create flow. + * @param string $identifier + * @return string + */ + private function createPageWithIdentifier($identifier) + { + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Save', + ], + ]; + $requestData = ['page' => + [ + PageInterface::IDENTIFIER => $identifier, + PageInterface::TITLE => 'Page title', + ], + ]; + + $result = $this->_webApiCall($serviceInfo, $requestData); + return $result['id']; + } + + /** + * Remove page with hard-coded-identifier + * @param string $pageId + * @return void + */ + private function deletePageByIdentifier($pageId) + { + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . '/' . $pageId, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'DeleteById', + ], + ]; + + $this->_webApiCall($serviceInfo, [PageInterface::PAGE_ID => $pageId]); + } }