class searchModelTest extends umiTestCase {private static $testFixtures = array();public static function searchModel() {return searchModel::getInstance();}public static function setUpBeforeClass() {self::searchModel()->truncate_index();$vacd150a6885f609532931d89844070b1 = self::createPageFixture(__CLASS__, 'content', '');$vacd150a6885f609532931d89844070b1->setName(__CLASS__ . ': Страница не в индексе');$vacd150a6885f609532931d89844070b1->setValue('is_unindexed', 1);$vacd150a6885f609532931d89844070b1->setValue('content', 'НеВИндексе');$vacd150a6885f609532931d89844070b1->commit();$v87da0c1d74d7335f83acb6f445b85a44 = self::createPageFixture(__CLASS__, 'content', '');$v87da0c1d74d7335f83acb6f445b85a44->setName(__CLASS__ . ': Страница с ожидаемым весом слов 2');$v87da0c1d74d7335f83acb6f445b85a44->setValue('content', 'Тестовое словосочетание, Тестовое словосочетание, на из под');$v87da0c1d74d7335f83acb6f445b85a44->commit();$vdc45392e1ce06fd88b3ddfd6097b165c = self::createPageFixture(__CLASS__, 'content', '');$vdc45392e1ce06fd88b3ddfd6097b165c->setValue('content', 'Тестовые словосочетания');$vdc45392e1ce06fd88b3ddfd6097b165c->setName(__CLASS__ . ': Страница с ожидаемым весом слов 1');$vdc45392e1ce06fd88b3ddfd6097b165c->commit();$ve70f6935e016a9688ee4aac0770d2c2d = self::createPageFixture(__CLASS__, 'content', '');$ve70f6935e016a9688ee4aac0770d2c2d->setValue('content', 'Тестовое словосочетание');$ve70f6935e016a9688ee4aac0770d2c2d->setValue('h1', 'Тестовое словосочетание');$ve70f6935e016a9688ee4aac0770d2c2d->setValue('title', 'Тестовое словосочетание');$ve70f6935e016a9688ee4aac0770d2c2d->setValue('meta_keywords', 'Тестовое словосочетание');$ve70f6935e016a9688ee4aac0770d2c2d->setValue('meta_descriptions', 'Тестовое словосочетание');$ve70f6935e016a9688ee4aac0770d2c2d->setValue('tags', 'Тестовое словосочетание');$ve70f6935e016a9688ee4aac0770d2c2d->setName(__CLASS__ . ': Страница с ожидаемым весом слов 20');$ve70f6935e016a9688ee4aac0770d2c2d->commit();self::$testFixtures = array($vacd150a6885f609532931d89844070b1, $v87da0c1d74d7335f83acb6f445b85a44, $vdc45392e1ce06fd88b3ddfd6097b165c, $ve70f6935e016a9688ee4aac0770d2c2d);}public static function tearDownAfterClass() {parent::tearDownAfterClass();}public function testValidInstance() {$this->assertInstanceOf('iSearchModel', self::searchModel());}public function testIndexWords() {$v6b0e852a75c7df2e71d825ff0b3e1f6c = array( "под", "словосочетание", "словосочетания", "тестовое", "тестовые" );sort($v6b0e852a75c7df2e71d825ff0b3e1f6c);$result = $this->queryResult('SELECT word FROM cms3_search_index_words');$v4dbdfdb5f7e507c8955733a7117cb0b3 = array();foreach ($result as $vf1965a857bc285d26fe22023aa5ab50d) {$v4dbdfdb5f7e507c8955733a7117cb0b3[] = $vf1965a857bc285d26fe22023aa5ab50d['word'];}$this->assertEquals($v6b0e852a75c7df2e71d825ff0b3e1f6c, $v4dbdfdb5f7e507c8955733a7117cb0b3, 'Проблема с индексацией');}public function testIndexPages() {$v2095ef595ca7725d6314002120972a48 = self::$testFixtures[1]->getId();$v04dbac8856e5a4f10e1486d1b3e601da = self::$testFixtures[2]->getId();$v600268ac8c643efd853a7fc65cdb99e3 = self::$testFixtures[3]->getId();$v6b0e852a75c7df2e71d825ff0b3e1f6c = <<<EOF
class umiTemplaterTPLParsePageTest extends umiTestCase {protected static $templater;protected static $page;protected static $globalVars = array();public static function setUpBeforeClass() {self::$page = self::createPageFixture(__CLASS__, 'content', '');self::$page->content = 'Content';self::$page->title = 'Title';self::$page->meta_keywords = 'Keywords';self::$page->meta_descriptions = 'Description';self::$page->h1 = 'Header';self::$page->commit();$_REQUEST['path'] = '/' . self::$page->getAltName() . "/";self::controller()->analyzePath();$_REQUEST['test_request_param'] = 'testRequestParamValue';$_SERVER['test_server_param'] = 'testServerParamValue';self::$globalVars = self::controller()->getGlobalVariables();self::$templater = umiTemplater::create('TPL', dirname(__FILE__) . "/data/umiTemplaterTPLParsePageTest.tpl");self::$templater->setScope(self::$page->getId());}public static function tearDownAfterClass() {parent::tearDownAfterClass();unset($_REQUEST['path']);unset($_REQUEST['test_request_param']);unset($_SERVER['test_server_param']);}public function testParseShortMacroses() {$v9a0364b9e99bb480dd25e1f0284c8555 = "%header%";$v4dbdfdb5f7e507c8955733a7117cb0b3 = self::$templater->parse(self::$globalVars, $v9a0364b9e99bb480dd25e1f0284c8555);$this->assertEquals('Header', $v4dbdfdb5f7e507c8955733a7117cb0b3);}public function testParsePage() {$v9cd3487945daada914909f0b525e1284 = self::$templater->getTemplatesSource();list($v511e361e2a3590145939f3c570b28689) = self::$templater->getTemplates($v9cd3487945daada914909f0b525e1284, 'common');$v9931b1f15d0ba2b903c892bbfcff0448 = file_get_contents($v9cd3487945daada914909f0b525e1284);$this->assertEquals($v9931b1f15d0ba2b903c892bbfcff0448, $v511e361e2a3590145939f3c570b28689, 'Ошибка загрузки основного шаблона');$v13904f6a3227fdaa70cb2fb689caff5e = self::$templater->parse(self::$globalVars, $v511e361e2a3590145939f3c570b28689);$v71860c77c6745379b0d44304d66b6a13 = self::$page;$v0db3209e1adc6d67be435a81baf9a66e = $v71860c77c6745379b0d44304d66b6a13->getId();$vd2a2244210ba075db32a5f093f85ad7e = <<<EOF
class umiTemplaterXSLTParsePageTest extends umiTestCase {protected static $templater;protected static $page;protected static $globalVars = array();protected static $actualResult;protected static $xPath;public static function setUpBeforeClass() {self::$page = self::createPageFixture(__CLASS__, 'content', '');self::$page->content = 'Content';self::$page->title = 'Title';self::$page->meta_keywords = 'Keywords';self::$page->meta_descriptions = 'Description';self::$page->h1 = 'Header';self::$page->commit();$_REQUEST['path'] = '/' . self::$page->getAltName() . "/";self::controller()->analyzePath(true);$_REQUEST['test_request_param'] = 'testRequestParamValue';$_SERVER['test_server_param'] = 'testServerParamValue';self::$templater = umiTemplater::create('XSLT', dirname(__FILE__) . "/data/umiTemplaterXSLTParsePageTest.xsl");self::$templater->setScope(self::$page->getId());self::$globalVars = self::controller()->getGlobalVariables();$v136a063334d3fa03b2febfbb4855cbc3 = self::$templater->parse(self::$globalVars);self::$actualResult = new DOMDocument('1.0', 'utf-8');self::$actualResult->loadXML($v136a063334d3fa03b2febfbb4855cbc3);self::$xPath = new DOMXPath(self::$actualResult);}public static function tearDownAfterClass() {parent::tearDownAfterClass();unset($_REQUEST['path']);unset($_REQUEST['test_request_param']);unset($_SERVER['test_server_param']);}public function testRequestParam() {$v1a13105b7e4eb5fb2e7c9515ac06aa48 = self::$xPath->evaluate("//test[@name = 'testRequestParam']");$this->assertEquals('testRequestParamValue', $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0)->nodeValue, 'Не передаются $_REQUEST-параметры в шаблон.');}public function testServerParam() {$v1a13105b7e4eb5fb2e7c9515ac06aa48 = self::$xPath->evaluate("//test[@name = 'testServerParam']");$this->assertEquals('testServerParamValue', $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0)->nodeValue, 'Не передаются $_SERVER-параметры в шаблон.');}public function testRepeatParse() {$v6052c20bf53f16f57139c21feff8ff8f = self::$actualResult;$v301ee7860666c81ec19ababbba418f26 = self::$templater->parse(self::$globalVars);$v1d137762d9282b91ae92344127e9cc59 = new DOMDocument('1.0', 'utf-8');$v1d137762d9282b91ae92344127e9cc59->loadXML($v301ee7860666c81ec19ababbba418f26);$this->assertEquals($v1d137762d9282b91ae92344127e9cc59->saveXML(), $v6052c20bf53f16f57139c21feff8ff8f->saveXML());}public function testParseSimpleProperties() {$v1a13105b7e4eb5fb2e7c9515ac06aa48 = self::$xPath->evaluate("//test[@name = 'testParseProperies']/prop[@name = 'title']");$this->assertNotEmpty($v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0));$this->assertEquals(self::$page->title, $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0)->nodeValue);$v1a13105b7e4eb5fb2e7c9515ac06aa48 = self::$xPath->evaluate("//test[@name = 'testParseProperies']/prop[@name = 'meta_keywords']");$this->assertNotEmpty($v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0));$this->assertEquals(self::$page->meta_keywords, $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0)->nodeValue);$v1a13105b7e4eb5fb2e7c9515ac06aa48 = self::$xPath->evaluate("//test[@name = 'testParseProperies']/prop[@name = 'meta_descriptions']");$this->assertNotEmpty($v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0));$this->assertEquals(self::$page->meta_descriptions, $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0)->nodeValue);$this->assertNotEmpty($v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0));$v1a13105b7e4eb5fb2e7c9515ac06aa48 = self::$xPath->evaluate("//test[@name = 'testParseProperies']/prop[@name = 'h1']");$this->assertEquals(self::$page->h1, $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0)->nodeValue);}public function testParseTplScopeMacroses() {if (defined('XML_MACROSES_DISABLE') && XML_MACROSES_DISABLE) {throw new Exception("Не могу протестировать обработку TPL-макросов, включена опция XML_MACROSES_DISABLE");}self::$page->content = '%meta_keywords%,%pid%';self::$page->commit();$v136a063334d3fa03b2febfbb4855cbc3 = self::$templater->parse(self::$globalVars);$v4dbdfdb5f7e507c8955733a7117cb0b3 = new DOMDocument('1.0', 'utf-8');$v4dbdfdb5f7e507c8955733a7117cb0b3->loadXML($v136a063334d3fa03b2febfbb4855cbc3);$v5e9f367e6f6a355657c806a522cc5afb = new DOMXPath($v4dbdfdb5f7e507c8955733a7117cb0b3);$v1a13105b7e4eb5fb2e7c9515ac06aa48 = $v5e9f367e6f6a355657c806a522cc5afb->evaluate("//test[@name = 'testParseProperies']/prop[@name = 'content']");$this->assertEquals(self::$page->meta_keywords. "," . self::$page->getId(), $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0)->nodeValue);}}
class umiTemplaterXSLTParseAdminPageTest extends umiTestCase {protected static $templater;protected static $page;protected static $globalVars = array();protected static $actualResult;protected static $xPath;public static function setUpBeforeClass() {self::$page = self::createPageFixture(__CLASS__, 'content', '');self::$page->content = 'Content';self::$page->title = 'Title';self::$page->meta_keywords = 'Keywords';self::$page->meta_descriptions = 'Description';self::$page->h1 = 'Header';self::$page->commit();self::controller()->setCurrentMode('admin');$_REQUEST['path'] = '/admin/content/edit/' . self::$page->getId() . "/";self::controller()->analyzePath();$_REQUEST['test_request_param'] = 'testRequestParamValue';$_SERVER['test_server_param'] = 'testServerParamValue';self::$templater = umiTemplater::create('XSLT', dirname(__FILE__) . "/data/umiTemplaterXSLTParsePageTest.xsl");self::$globalVars = self::controller()->getGlobalVariables();$v136a063334d3fa03b2febfbb4855cbc3 = self::$templater->parse(self::$globalVars);self::$actualResult = new DOMDocument('1.0', 'utf-8');self::$actualResult->loadXML($v136a063334d3fa03b2febfbb4855cbc3);self::$xPath = new DOMXPath(self::$actualResult);}public static function tearDownAfterClass() {parent::tearDownAfterClass();unset($_REQUEST['path']);unset($_REQUEST['test_request_param']);unset($_SERVER['test_server_param']);}public function _testStreamWork() {$result = file_get_contents('udata://system/get_module_tabs/content/content');}public function testRequestParam() {$v1a13105b7e4eb5fb2e7c9515ac06aa48 = self::$xPath->evaluate("//test[@name = 'testRequestParam']");$this->assertEquals('testRequestParamValue', $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0)->nodeValue, 'Не передаются $_REQUEST-параметры в шаблон.');}}