/** * Test of the build function. * * @param array $queryExpected The expected parsed query.. * @param string $url URL to be parsed. * @param array $exceptions Array of exceptional menu items, where the URL is different. * * @dataProvider buildProvider * @return null */ public function testParse($queryExpected, $url, $exceptions) { $modelProject = MonitorTestMockModelProject::create($this); $modelIssue = MonitorTestMockModelIssue::create($this); MonitorTestMockMenu::createMenuSampleData(); for ($i = 0; $i < MonitorTestMockMenu::getItemCount(); $i++) { MonitorTestMockMenu::setActiveIndex($i); $menu = MonitorTestMockMenu::create($this); $router = new MonitorRouter($this->getMockCmsApp(), $menu, $modelProject, $modelIssue); $description = "Active Item: ({$i}) " . $menu->getActive()->link . "\n"; // TODO: Test query rest if (isset($exceptions[$i])) { $segments = explode('/', $exceptions[$i]); $description .= "URL: " . $exceptions[$i]; } else { $segments = explode('/', $url); $description .= "URL: " . $url; } $query = $router->parse($segments); MonitorRouter::convertTaskToView($query); MonitorRouter::convertTaskToView($queryExpected); $this->assertEquals($queryExpected, $query, $description); } }