/** * @covers Veles\Routing\Route::isAjax * @covers Veles\Routing\Route::checkAjax * @covers Veles\Routing\Route::getUri * * @dataProvider isAjaxProvider * * @param $uri * @param $expected */ public function testIsAjax($uri, $expected) { $this->object = $this->getMockBuilder('\\Veles\\Routing\\Route')->setMethods(['getUri', 'checkAjax'])->getMock(); $config = new RoutesConfig(new IniConfigLoader(TEST_DIR . '/Project/routes.ini')); $this->object->setConfigHandler($config); $this->object->method('getUri')->willReturn($uri); $this->object->method('checkAjax')->willReturn($expected); $result = $this->object->init()->isAjax(); $msg = 'Wrong Route::isAjax() result!'; $this->assertSame($expected, $result, $msg); }
public function testGetRoute() { $expected = new Route(); $config = new RoutesConfig(new IniConfigLoader(TEST_DIR . '/Project/routessdfsdfsdf.ini')); $expected->setConfigHandler($config); $object = new Application(); $object->setRoute($expected); $result = $object->getRoute(); $msg = 'Application::getRoute() returns wrong result!'; $this->assertSame($expected, $result, $msg); }