<?php
|
|
/**
|
|
* Input.test.php
|
|
* Test Base controller.
|
|
* @version 150629:1
|
|
* @author karminski <code.karminski@outlook.com>
|
|
*
|
|
*/
|
|
|
|
require(dirname(__FILE__).'/../protected/lib/base/Input.php');
|
|
|
|
|
|
|
|
$input_param = array(
|
|
array(
|
|
'param' => 'id',
|
|
'condition' => array(
|
|
'method' => null,
|
|
'type' => Input::TYPE_INT,
|
|
'limit' => array('min' => 0, 'max' => 100000000),
|
|
'default' => 0,
|
|
'necessary' => true,
|
|
),
|
|
),
|
|
array(
|
|
'param' => 'type',
|
|
'condition' => array(
|
|
'method' => null,
|
|
'type' => Input::TYPE_ENUM,
|
|
'options' => array("a", "b", "c", 0),
|
|
'default' => 0,
|
|
'necessary' => true,
|
|
),
|
|
),
|
|
array(
|
|
'param' => 'data',
|
|
'condition' => array(
|
|
'method' => null,
|
|
'type' => Input::TYPE_STRING,
|
|
'sub_type' => Input::TYPE_STRING,
|
|
'limit' => array('fixed' => 32),
|
|
'default' => null,
|
|
'necessary' => true,
|
|
),
|
|
),
|
|
array(
|
|
'param' => 'token',
|
|
'condition' => array(
|
|
'method' => null,
|
|
'type' => Input::TYPE_STRING,
|
|
'limit' => array('fixed' => 32),
|
|
'default' => '',
|
|
'necessary' => true,
|
|
),
|
|
),
|
|
array(
|
|
'param' => 'callback',
|
|
'condition' => array(
|
|
'method' => null,
|
|
'type' => Input::TYPE_STRING,
|
|
'limit' => array('min' => 1, 'max' => 40),
|
|
'default' => '',
|
|
'necessary' => false,
|
|
),
|
|
),
|
|
array(
|
|
'param' => 'src',
|
|
'condition' => array(
|
|
'method' => null,
|
|
'type' => Input::TYPE_STRING,
|
|
'limit' => array('min' => 1, 'max' => 40),
|
|
'default' => '',
|
|
'necessary' => false,
|
|
),
|
|
),
|
|
);
|
|
|
|
$_GET = array(
|
|
'id' => 12,
|
|
'type' => 'a',
|
|
'callback' => 'json_callback_21453534534',
|
|
'src' => 'pc_452345',
|
|
);
|
|
|
|
$r = array();
|
|
$exp = array();
|
|
|
|
Input::get(Input::METHOD_GET, $input_param, $r, $exp);
|
|
|
|
var_dump($r);
|
|
var_dump($exp);
|