Exemplo n.º 1
0
 /**
  * Тестирует вставку документа
  */
 public function testSavePage()
 {
     $nId = Sitemap::addPage('Test inserting', 'xx', TestDocument::ModelName, 1, 0);
     $data = array('document_name' => TestDocument::ModelName, 'document_id' => 1, 'name' => 'test update', 'url_key' => 'test');
     Sitemap::savePage($data);
     // Получаем запись в бд
     $urlInfo = Sitemap_Sample::get($nId);
     $this->AssertEquals($urlInfo['name'], $data['name']);
     $this->AssertEquals($urlInfo['full_url'], '///' . $data['url_key'] . '/');
 }
Exemplo n.º 2
0
 /**
  *
  * @param int $parentSitemapId индекс в таблице sitemap
  *
  * @see Document::insert()
  */
 public function insert($parentSitemapId = 0)
 {
     $result = parent::insert();
     if ($this->withSitemap) {
         // Получаем сайтмап данные
         $sitemapInfo = $this->returnSitemapParams();
         // Добавляем
         Sitemap::addPage($sitemapInfo['name'], $sitemapInfo['url_key'], static::ModelName, $this->id->getValue(), $parentSitemapId);
         // Загружаем
         $this->needSitemapData();
     }
     //
     return $result;
 }