public function testChildPage1() { $root = Kwf_Component_Data_Root::getInstance(); $c = $root->getComponentById('root-en'); Kwf_Debug::enable(); $c = $c->getChildComponent('_1'); $this->assertEquals('root-en_1', $c->componentId); }
public function testPages() { $c = $this->_root->getChildComponent('-1')->getChildComponents(); $this->assertEquals(count($c), 1); $c = $this->_root->getChildComponent('-1')->getChildComponents(array('filename' => 'bar')); $this->assertEquals(count($c), 1); $c = $this->_root->getChildComponent('-1'); Kwf_Debug::enable(); $c = $c->getChildComponents(array('filename' => 'bar')); $this->assertEquals(count($c), 1); $this->assertEquals(current($c)->componentId, 'root-1_1'); $c = $this->_root->getRecursiveChildComponents(array('filename' => 'bar')); $this->assertEquals(count($c), 1); $this->assertEquals(current($c)->componentId, 'root-1_1'); }
public function testNewlineInIndex() { $fnf = new Kwf_Model_Proxycache_TestFnF(array('uniqueIdentifier' => 'unique')); $fnf->setData(array(array('id' => 1, 'en' => "foo\nbar", 'de' => "foo\\nbar"))); $proxy = new Kwf_Model_ProxyCache(array('proxyModel' => $fnf, 'cacheSettings' => array(array('index' => array('en'), 'columns' => array()), array('index' => array('de'), 'columns' => array())))); Kwf_Debug::enable(); $proxy->clearCache(); $row = $proxy->getRow($proxy->select()->whereEquals('en', "foo\nbar")); $this->assertEquals(1, $fnf->getRowsCalled); $row = $proxy->getRow($proxy->select()->whereEquals('en', "foo\nbar")); $this->assertEquals(1, $row->id); $this->assertEquals(1, $fnf->getRowsCalled); $row = $proxy->getRow($proxy->select()->whereEquals('de', "foo\\nbar")); $this->assertEquals(2, $fnf->getRowsCalled); $row = $proxy->getRow($proxy->select()->whereEquals('de', "foo\\nbar")); $this->assertEquals(1, $row->id); $this->assertEquals(2, $fnf->getRowsCalled); }