fclose($f); // This section gets forecasted.csv from the output folder and saves it locally so it can be used elsewhere more easily $f = fopen("forecast.csv", "w+b"); $fileMetadata = $dbxClient->getFile("/Software_Methodologies/Output/forecasted.csv", $f); fclose($f); $app = new \Slim\Slim(array('view' => new \Slim\Views\Twig())); $app->add(new \Slim\Middleware\SessionCookie()); $view = $app->view(); $view->parserOptions = array('debug' => true); $view->parserExtensions = array(new \Slim\Views\TwigExtension()); //ADD ALL THE PAGES///// $app->get('/', function () use($app) { $app->render('home.twig'); })->name('home'); $app->get('/w', function () use($app) { $mape = calculate_mape('actual.csv', 'forecast.csv'); $app->render('weather.twig', array('mape' => $mape)); })->name('weather'); $app->get('/homeerror', function () use($app) { $app->render('homeerror.twig'); })->name('homeerror'); $app->get('/temperature', function () use($app) { $app->render('temperature.twig'); })->name('temperature'); $app->get('/wind-speed', function () use($app) { $app->render('wind_speed.twig'); })->name('wind_speed'); $app->get('/upload', function () use($app) { $app->render('upload.html'); })->name('/upload'); //ADD ALL THE PAGES/////
public function test_calculate_mape() { $this->assertEquals(calculate_mape('C:/xampp/htdocs/Software_Methodologies_Project/htdocs/templates/actual.csv', 'C:/xampp/htdocs/Software_Methodologies_Project/htdocs/templates/forecast.csv'), 40.320369641366); }