Skip to content

Commit 82d7789

Browse files
MAGETWO-52215: Cms pages isn't synchronized with core_config_data
1 parent 2701251 commit 82d7789

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

app/code/Magento/Cms/Model/Page.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,15 @@ public function beforeSave()
528528

529529
switch ($originalIdentifier) {
530530
case $this->getScopeConfig()->getValue(PageHelper::XML_PATH_NO_ROUTE_PAGE):
531-
throw new LocalizedException(__('This identifier is reserved for 404 error page in configuration.'));
531+
throw new LocalizedException(
532+
__('This identifier is reserved for "CMS No Route Page" in configuration.')
533+
);
532534
case $this->getScopeConfig()->getValue(PageHelper::XML_PATH_HOME_PAGE):
533-
throw new LocalizedException(__('This identifier is reserved for home page in configuration.'));
535+
throw new LocalizedException(__('This identifier is reserved for "CMS Home Page" in configuration.'));
536+
case $this->getScopeConfig()->getValue(PageHelper::XML_PATH_NO_COOKIES_PAGE):
537+
throw new LocalizedException(
538+
__('This identifier is reserved for "CMS No Cookies Page" in configuration.')
539+
);
534540
}
535541

536542
return parent::beforeSave();

app/code/Magento/Cms/Test/Unit/Model/PageTest.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function testCheckIdentifier()
119119

120120
/**
121121
* @expectedException \Magento\Framework\Exception\LocalizedException
122-
* @expectedExceptionMessage This identifier is reserved for 404 error page in configuration.
122+
* @expectedExceptionMessage This identifier is reserved for "CMS No Route Page" in configuration.
123123
*/
124124
public function testBeforeSave404Identifier()
125125
{
@@ -145,7 +145,7 @@ public function testBeforeSave404Identifier()
145145

146146
/**
147147
* @expectedException \Magento\Framework\Exception\LocalizedException
148-
* @expectedExceptionMessage This identifier is reserved for home page in configuration.
148+
* @expectedExceptionMessage This identifier is reserved for "CMS Home Page" in configuration.
149149
*/
150150
public function testBeforeSaveHomeIdentifier()
151151
{
@@ -168,4 +168,30 @@ public function testBeforeSaveHomeIdentifier()
168168

169169
$this->model->beforeSave();
170170
}
171+
172+
/**
173+
* @expectedException \Magento\Framework\Exception\LocalizedException
174+
* @expectedExceptionMessage This identifier is reserved for "CMS No Cookies Page" in configuration.
175+
*/
176+
public function testBeforeSaveNoCookiesIdentifier()
177+
{
178+
$this->model->setId(1);
179+
$this->model->setOrigData('identifier', 'no-cookies');
180+
$this->model->setIdentifier('no-cookies2');
181+
182+
$this->scopeConfigMock->expects($this->atLeastOnce())
183+
->method('getValue')
184+
->willReturnMap(
185+
[
186+
[
187+
\Magento\Cms\Helper\Page::XML_PATH_NO_COOKIES_PAGE,
188+
ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
189+
null,
190+
'no-cookies'
191+
]
192+
]
193+
);
194+
195+
$this->model->beforeSave();
196+
}
171197
}

0 commit comments

Comments
 (0)