选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
查看 sfValidatorBlacklistTest.php - 文件管理器
👁 查看:sfValidatorBlacklistTest.php
路径:/virtual/bigbrother/sns/plugins/sfFormExtraPlugin/test/validator/sfValidatorBlacklistTest.php
大小:1.89 KB · 修改:2010-08-10 13:59:42 · 权限:0644 · 可写
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once dirname(__FILE__).'/../bootstrap.php';
require_once dirname(__FILE__).'/../../lib/validator/sfValidatorBlacklist.class.php';

$t = new lime_test(5, new lime_output_color());

// __construct()
$t->diag('__construct()');
try
{
  new sfValidatorBlacklist();
}
catch (RuntimeException $e)
{
  $t->pass('__construct() expects a "forbidden_values" option');
}

$v = new sfValidatorBlacklist(array('forbidden_values' => array('foo', 'bar', 'baz')));

// ->clean()
$t->diag('->clean()');
try
{
  $v->clean('foo'); // "foo" is a forbidden value
  $t->fail('->clean() does not throw a sfValidatorError when the submitted value is invalid');
  $t->skip();
}
catch (sfValidatorError $e)
{
  $t->pass('->clean() does not throw a sfValidatorError when the submitted value is invalid');
  $t->is($e->getCode(), 'invalid', '->clean() throws a "invalid" error');
}

try
{
  $v->clean('gonzagues'); // "foo" is not a forbidden value
  $t->pass('->clean() does not throw a sfValidatorError when the submitted value is valid');
}
catch (sfValidatorError $e)
{
  $t->fail('->clean() does not throw a sfValidatorError when the submitted value is valid');
  $t->skip();
}


$v = new sfValidatorBlacklist(array('forbidden_values' => array('Foo', 'bAr', 'baZ'), 
                                    'case_sensitive'   => false));
try
{
  $v->clean('baz'); // "baz" is a forbidden value in a case sensitive context
  $t->fail('->clean() throws a sfValidatorError when the submitted value is invalid in a case sensitive context');
  $t->skip();
}
catch (sfValidatorError $e)
{
  $t->pass('->clean() throws a sfValidatorError when the submitted value is invalid in a case sensitive context');
}
ページが見つかりませんでした – Lumiere Shop
ここを指しているリンクに誤りがあったようです。検索してみるのはいかがですか ?
お買い物カゴ