/** * @param string $url The URL * @param string $expected Expected return value * * @dataProvider casesProcessBuildRulesOrder * * @since 4.0 */ public function testStagesAreProcessedInCorrectOrder($url, $expected) { $this->object->attachBuildRule(function (JRouter $router, JUri $uri) { $uri->setVar('var1', 'before'); $uri->setVar('var3', 'before'); $uri->setVar('var4', 'before'); }, JRouter::PROCESS_BEFORE); $this->object->attachBuildRule(function (JRouter $router, JUri $uri) { $uri->setVar('var1', 'during'); $uri->setVar('var4', 'during'); $uri->setVar('var5', 'during'); }, JRouter::PROCESS_DURING); $this->object->attachBuildRule(function (JRouter $router, JUri $uri) { $uri->setVar('var1', 'after'); $uri->setVar('var5', 'after'); }, JRouter::PROCESS_AFTER); $this->assertEquals($expected, (string) $this->object->build($url)); }
/** * Tests the attachBuildRule() method throwing a proper exception * * @return void * * @since 3.4 * @expectedException InvalidArgumentException */ public function testAttachBuildRuleException() { $callback = array(function (&$router, &$uri) { }); $this->object->attachBuildRule($callback, 'wrongStage'); }