/** * 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); }