测试控制器。单元测试(无效)

时间:2018-08-09 14:52:27

标签: unit-testing testing controller void

我有Ajax方法,以tojson结尾。在方法中,他们形成并分组为数组$ response = ['code'=> $ responseCode,'message'=> $ message];

public function recoverPasswordAjax() {
    $message = _('Произошла ошибка, попробуйте еще раз.');
    $responseCode = 0;
    $response = [
       'code'       => $responseCode,
        'message'   => $message
    ];
    $this->toJSON($response, true);
}


    final public function toJSON($var, $send = false, $mask = 0) {
       $result = toJSON($var, $mask);
       if ($send) {
           header('Content-Type: application/json; charset=utf-8');
           print($result);
           exit();
       }
     return $result;
   }



 function toJSON($var, $mask = 0) {
        $result = json_encode($var, $mask);
        return $result ? $result : '';
    }

该如何测试或仅进行功能测试?

0 个答案:

没有答案