<?php $testSuite->createGroup('Requests / Admin / Priorities', function ($g) { $admin = createAdmin(); $priority = createPriority(); $g->test('List priorities', function ($t) use($admin, $priority) { $resp = $t->visit('admin_priorities', ['cookie' => ['traq' => $admin['session_hash']]]); $t->assertEquals(200, $resp->status); $t->assertContains($priority['name'], $resp->body); }); $g->test('New priority form', function ($t) use($admin) { $resp = $t->visit('admin_new_priority', ['cookie' => ['traq' => $admin['session_hash']]]); $t->assertEquals(200, $resp->status); $t->assertContains('<h1 class="page-header">New Priority</h1>', $resp->body); }); $g->test('Create priority', function ($t) use($admin) { $resp = $t->visit('admin_create_priority', ['method' => 'POST', 'post' => ['name' => 'My Priority'], 'cookie' => ['traq' => $admin['session_hash']]]); $t->assertRedirectTo($t->generateUrl('admin_priorities'), $resp); }); $g->test('Name in use', function ($t) use($admin) { $resp = $t->visit('admin_create_priority', ['method' => 'POST', 'post' => ['name' => 'High'], 'cookie' => ['traq' => $admin['session_hash']]]); $t->assertEquals(200, $resp->status); $t->assertContains('Name is already in use', $resp->body); }); $g->test('Edit priority form', function ($t) use($admin, $priority) { $resp = $t->visit('admin_edit_priority', ['routeTokens' => ['id' => $priority['id']], 'cookie' => ['traq' => $admin['session_hash']]]); $t->assertEquals(200, $resp->status); $t->assertContains('<h1 class="page-header">Edit Priority</h1>', $resp->body); }); $g->test('Update priority', function ($t) use($admin, $priority) { $resp = $t->visit('admin_save_priority', ['method' => 'PATCH', 'routeTokens' => ['id' => $priority['id']], 'post' => ['name' => 'Just Another Priority'], 'cookie' => ['traq' => $admin['session_hash']]]);
<?php include 'config/autoload.php'; print_r($_SESSION); if (isset($_POST['createArea']) and isset($_POST['title'])) { createArea($db, 'FRA', $_POST['title']); } if (isset($_POST['createPriority']) and isset($_POST['priorityType']) and isset($_POST['title'])) { createPriority($db, $_POST['priorityType'], 'FRA', $_POST['title']); createAreaPriority($db, $_SESSION['area_id'], $_SESSION['priority_id']); } if (isset($_POST['createTheme']) and isset($_POST['title'])) { createTheme($db, 'FRA', $_POST['title']); createPriorityTheme($db, $_SESSION['priority_id'], $_SESSION['theme_id']); } ?> <style> table, th, td { border: 1px solid black; } </style> <h3>Gestion des catégories : domaine, priorité et thème</h3> <p> <a href="home.php">Retour à l'accueil</a> </p> <form action="categories.php" method="post"> <fieldset> <legend>1 - Création d'un domaine :</legend>