public function testIgnoreParentAndDocsAndWhere() { $out = array("SELECT count(*) FROM (SELECT count(*) FROM site_content as `c` WHERE `price`>0 AND c.deleted=0 AND c.published=1 AND ((c.parent IN ('5')) OR c.id IN('10','12')) GROUP BY c.id) as `tmp`", "SELECT c.* FROM site_content as `c` WHERE `price`>0 AND ((c.parent IN ('5')) OR c.id IN('10','12')) AND c.deleted=0 AND c.published=1 GROUP BY c.id ORDER BY if(c.pub_date=0,c.createdon,c.pub_date) DESC LIMIT 0,10"); $DL = $this->mockDocLister('site_content', array('debug' => 1, 'idType' => 'parents', 'parents' => 5, 'documents' => '10,12', 'showParent' => "-1", 'addWhereList' => '`price`>0', 'paginate' => 'pages', 'display' => 10)); $DL->debug->clearLog(); $DL->getChildrenCount(); $this->getMethod($DL, "getChildrenList")->invoke($DL); $debug = new \Helpers\Collection($DL->debug->getLog()); $getChildrenCount = $debug->get(0); $getChildrenList = $debug->get(1); $this->assertEquals($out[0], trim($getChildrenCount['msg'])); $this->assertEquals($out[1], trim($getChildrenList['msg'])); }
public function testIgnoreParentAndDocsAndWhere() { $out = array("SELECT count(*) FROM (SELECT count(*) FROM site_content WHERE `price`>0 AND ((`parent` IN ('5')) OR `id` IN('10','12')) GROUP BY `id`) as `tmp`", "SELECT * FROM site_content WHERE `price`>0 AND (((`parent` IN ('5'))) OR id IN('10','12')) GROUP BY `id` ORDER BY id DESC LIMIT 0,10"); $DL = $this->mockDocLister('onetable', array('debug' => 1, 'idType' => 'parents', 'parents' => 5, 'documents' => '10,12', 'showParent' => "-1", 'addWhereList' => '`price`>0', 'paginate' => 'pages', 'display' => 10)); $DL->debug->clearLog(); $DL->getChildrenCount(); $this->getMethod($DL, "getChildrenList")->invoke($DL); $debug = new \Helpers\Collection($DL->debug->getLog()); $getChildrenCount = $debug->get(0); $getChildrenList = $debug->get(1); $this->assertEquals($out[0], trim($getChildrenCount['msg'])); $this->assertEquals($out[1], trim($getChildrenList['msg'])); }