Пример #1
0
 public function testAnnotationForGetActionMethods()
 {
     $con = new ChildController();
     $map = $con->getActionMethods();
     $this->assertNotEmpty($map);
     $this->assertTrue(is_array($map));
     $this->assertTrue(isset($map['postAction']));
     $this->assertTrue(isset($map['pageAction']));
     $this->assertTrue(isset($map['subpageAction']));
     is(array(array("Route" => "/post", "Method" => "POST"), array("class" => "ChildController")), $map['postAction']);
     $routeMap = $con->getActionRoutes();
     $this->assertCount(3, $routeMap);
     list($path, $method, $options) = $routeMap[0];
     is('/page', $path);
     is('pageAction', $method);
     is(array('method' => REQUEST_METHOD_GET), $options);
 }
        } else {
            ChildController::update(null, $_REQUEST);
        }
        break;
    case 'POST':
        ChildController::create($_POST);
        break;
    case 'GET':
        if (isset($request) && !empty($request) && $request[0] !== '') {
            if ($request[0] == 'filter') {
                $value = $request[1];
                ChildController::filter($value);
            } else {
                $id = $request[0];
                ChildController::detail($id);
            }
        } else {
            ChildController::read();
        }
        break;
    case 'DELETE':
        if (isset($request) && !empty($request) && $request[0] !== '') {
            $id = $request[0];
            ChildController::delete($id);
        }
        break;
    default:
        return print json_encode('DECISION SUPPORT SYSTEM API v.0.1 developed by: Philip Cesar B. Garay');
        break;
}
exit;