public function testDelete()
 {
     $commentMapper = new CommentMapper();
     $commentMapper->setId(50);
     $commentMapper->deleteComment();
     $this->assertEquals(new Comment(), $commentMapper->selectComment());
 }
<?php

/**
 * Get the HTTP method and differents data.
 */
$http = Rest::initProcess();
switch ($http->getMethod()) {
    case 'get':
        $comment_ = new Comment();
        $commentMapper = new \CommentMapper();
        $commentObject = $commentMapper->selectComment();
        $commentArray = extractData($commentObject);
        if (!empty($commentArray)) {
            if ($http->getHttpAccept() == 'json') {
                Rest::sendResponse(200, json_encode($commentArray), 'application/json');
            } else {
                if ($http->getHttpAccept() == 'xml') {
                    $options = array('indent' => '     ', 'addDecl' => false, "defaultTagName" => "comment", XML_SERIALIZER_OPTION_RETURN_RESULT => true);
                    $serializer = new XML_Serializer($options);
                    Rest::sendResponse(200, $serializer->serialize($commentArray), 'application/xml');
                }
            }
        } else {
            Rest::sendResponse(204);
        }
        break;
    case 'delete':
        $commentMapper = new \CommentMapper();
        if ($commentMapper->deleteComment()) {
            Rest::sendResponse(200);
        }
<?php

$http = Rest::initProcess();
switch ($http->getMethod()) {
    case 'get':
        $commentMapper = new CommentMapper();
        $commentsObject = $commentMapper->selectComment(true);
        $result = true;
        if (is_array($commentsObject) && !is_null($commentsObject)) {
            foreach ($commentsObject as $commentObject) {
                $result = emptyObject($commentObject);
            }
        }
        if (!$result) {
            foreach ($commentsObject as $commentObject) {
                $commentsArray[] = extractData($commentObject);
            }
            if ($http->getHttpAccept() == 'json') {
                Rest::sendResponse(200, json_encode($commentsArray), 'application/json');
            } else {
                if ($http->getHttpAccept() == 'xml') {
                    $options = array('indent' => '     ', 'addDecl' => false, XML_SERIALIZER_OPTION_RETURN_RESULT => true, "defaultTagName" => "comment");
                    $serializer = new XML_Serializer($options);
                    Rest::sendResponse(200, $serializer->serialize($commentsArray), 'application/xml');
                }
            }
        } else {
            Rest::sendResponse(204);
        }
        break;
    case 'post':