doupang1917 2017-06-05 12:58
浏览 19
已采纳

PHPUnit找不到Phalcon的Callback验证器(命名空间问题)

I'm using Phalcon 3.0.3 and PHP 7.0.15-0ubuntu0.16.04.4 with PHPUnit 6.0.8. If I try to use Phalcon\Validation\Validator\Callback I'll always end up with those kind of errros:

1) Test\ConfirmActivityTest::testConfirm Error: Class 'Phalcon\Validation\Validator\Callback' not found

So far the only way I found to solve this problem is to create a copy of that class in my codebase:

namespace Phapp\Validators;

/**
 * A workaround to fix the namespace problem of
 * Phalcon\Validation\Validator\Callback
 *
 */
class CallbackValidator extends \Phalcon\Validation\Validator
{

    /**
     * Executes the validation
     *
     * @param \Phalcon\Validation $validation
     * @param string $field
     * @return bool
     */
    public function validate(\Phalcon\Validation $validation, $field) {}

}

Is there any other workaround I could use to solve this problem? Is it a Phalcon bug?

  • 写回答

1条回答 默认 最新

  • doutongya8378 2017-06-05 19:50
    关注

    Callback validator was added in 3.1.0. Docs were by mistake merged as i remember.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 imageEnView绘图问题
  • ¥15 关于#python#的问题:您好可以加您一下联系方式吗,在复现的时候确实有点问题难以解决
  • ¥15 联想电脑重装系统时无法发现硬盘
  • ¥15 MATLAB与UR10e实体机械臂建立通讯
  • ¥15 c++题需要快一点不用opencv
  • ¥15 关于#java#的问题:想要咨询Flowable流程引擎框架的问题
  • ¥15 vscode里面怎么用plaformio强调串口啊
  • ¥20 针对计算后数据做一致性检验可以用Bland Altman法吗
  • ¥15 win32如何自绘编辑框的背景图片(语言-c++|操作系统-windows)
  • ¥15 微信夜间被转走了1w对,当天手机剪切板里就出现了这个乱码,有铁子可以看看是啥吗可以