示例#1
0
 protected function setUp()
 {
     $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->block = $objectManager->getObject('Magento\\Cms\\Block\\Page');
     $this->page = $objectManager->getObject('Magento\\Cms\\Model\\Page');
     $this->page->setId(1);
 }
示例#2
0
 protected function setUp()
 {
     $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->block = $objectManager->getObject('Magento\\Cms\\Block\\Page');
     $this->page = $objectManager->getObject('Magento\\Cms\\Model\\Page');
     $reflection = new \ReflectionClass($this->page);
     $reflectionProperty = $reflection->getProperty('_idFieldName');
     $reflectionProperty->setAccessible(true);
     $reflectionProperty->setValue($this->page, 'page_id');
     $this->page->setId(1);
 }
示例#3
0
 /**
  * @expectedException \Magento\Framework\Exception\LocalizedException
  * @expectedExceptionMessage This identifier is reserved for "CMS No Cookies Page" in configuration.
  */
 public function testBeforeSaveNoCookiesIdentifier()
 {
     $this->model->setId(1);
     $this->model->setOrigData('identifier', 'no-cookies');
     $this->model->setIdentifier('no-cookies2');
     $this->scopeConfigMock->expects($this->atLeastOnce())->method('getValue')->willReturnMap([[\Magento\Cms\Helper\Page::XML_PATH_NO_COOKIES_PAGE, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, 'no-cookies']]);
     $this->model->beforeSave();
 }