public function testDeleteCategory()
 {
     // Arrange
     $changeCategory = new ChangeCategory();
     $connection = open_database_connection();
     $expectedResult = $changeCategory->addCategory($connection, "PHP Unit Test Category", "", "", "PHP Unit Test Summary");
     // Act
     $result = $changeCategory->deleteCategory($connection, "PHP Unit Test Category");
     // Assert
     $this->assertEquals($result, $expectedResult);
 }
 /**
  * Action for deleting a category.
  *
  * Action for route: /adminDeleteCategory
  *
  * @param Request $request
  * @param Application $app
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function deleteCategoryAction(Request $request, Application $app)
 {
     // test if 'username' stored in session ...
     $username = getAuthenticatedUserName($app);
     // check if we are authenticated --------
     $isAuthenticated = null != $username;
     if (!$isAuthenticated) {
         // not authenticated, so redirect to LOGIN page
         return $app->redirect('/login');
     }
     $categoryID = $_GET['categoryID'];
     $categoryName = $_GET['categoryName'];
     $resultMessage = "";
     $connection = open_database_connection();
     /*
     if(isset($_GET['no'])) {
         return $app->redirect("/adminChangeCategory");
     }
     if(isset($_GET['yes'])) {
         $changeCategoryObject = new ChangeCategory();
         $resultMessage = $changeCategoryObject->deleteCategory($connection, $categoryID);
     }
     */
     $changeCategoryObject = new ChangeCategory();
     $resultMessage = $changeCategoryObject->deleteCategory($connection, $categoryID);
     close_database_connection($connection);
     if ($resultMessage == "items_exist") {
         $app['session']->set('items_exist', true);
     }
     return $app->redirect("/adminChangeCategory");
     /**
             // store username into args array
             $argsArray = array(
        'title' => "Delete category ".$categoryName,
        'username' => $username,
        'categoryID' => $categoryID,
        'categoryName' => $categoryName,
        'resultMessage' => $resultMessage,
             );
     
             // render (draw) template
             // ------------
             $templateName = 'admin/deleteCategory';
             return $app['twig']->render($templateName . '.html.twig', $argsArray);
     */
 }