/** * Tests the build() method * * @return void * * @since 3.4 */ public function testBuild() { // Test if the rule is properly skipped if an Itemid is set $query = array('option' => 'com_test', 'view' => 'article', 'id' => '42:the-answer', 'Itemid' => '42'); $segments = array(); $this->object->build($query, $segments); $this->assertEquals(array('option' => 'com_test', 'view' => 'article', 'id' => '42:the-answer', 'Itemid' => '42'), $query); $this->assertEquals(array(), $segments); // Test if a false view is properly not treated $query = array('option' => 'com_content', 'view' => 'falseview', 'id' => '42:the-answer'); $segments = array(); $this->object->build($query, $segments); $this->assertEquals(array('option' => 'com_content', 'view' => 'falseview', 'id' => '42:the-answer'), $query); $this->assertEquals(array(), $segments); // Test if a single view without identifier is properly build $query = array('option' => 'com_content', 'view' => 'featured'); $segments = array(); $this->object->build($query, $segments); $this->assertEquals(array('option' => 'com_content'), $query); $this->assertEquals(array('featured'), $segments); // Test if a single view with identifier is properly build $query = array('option' => 'com_content', 'view' => 'article', 'id' => '42:the-answer'); $segments = array(); $this->object->build($query, $segments); $this->assertEquals(array('option' => 'com_content'), $query); $this->assertEquals(array('article', '42-the-answer'), $segments); }
/** * Tests the buildLookup() method * * @return void * * @since 3.5 */ public function testBuildLookup() { $this->assertEquals(array('*' => array('featured' => '47', 'categories' => array(14 => '48'), 'category' => array(20 => '49'))), $this->object->get('lookup')); $this->object->runBuildLookUp('en-GB'); $this->assertEquals(array('*' => array('featured' => '47', 'categories' => array(14 => '48'), 'category' => array(20 => '49')), 'en-GB' => array('featured' => '51', 'categories' => array(14 => '50'), 'category' => array(20 => '49'))), $this->object->get('lookup')); }