예제 #1
0
 function test()
 {
     $arg = new Argument('--option');
     ok($arg->isLongOption());
     not_ok($arg->isShortOption());
     is('option', $arg->getOptionName());
 }
예제 #2
0
 public function testDefaultEnabledVariants()
 {
     $settings = new DefaultBuildSettings();
     not_ok($settings->isEnabledVariant('sqlite'));
     ok($settings->isEnabledVariant('bcmath'));
     ok($settings->isEnabledVariant('bz2'));
     ok($settings->isEnabledVariant('calendar'));
     ok($settings->isEnabledVariant('cli'));
     ok($settings->isEnabledVariant('ctype'));
     ok($settings->isEnabledVariant('dom'));
     ok($settings->isEnabledVariant('fileinfo'));
     ok($settings->isEnabledVariant('filter'));
     ok($settings->isEnabledVariant('ipc'));
     ok($settings->isEnabledVariant('json'));
     ok($settings->isEnabledVariant('mbregex'));
     ok($settings->isEnabledVariant('mbstring'));
     ok($settings->isEnabledVariant('mhash'));
     ok($settings->isEnabledVariant('pcntl'));
     ok($settings->isEnabledVariant('pcre'));
     ok($settings->isEnabledVariant('pdo'));
     ok($settings->isEnabledVariant('phar'));
     ok($settings->isEnabledVariant('posix'));
     ok($settings->isEnabledVariant('readline'));
     ok($settings->isEnabledVariant('sockets'));
     ok($settings->isEnabledVariant('tokenizer'));
     ok($settings->isEnabledVariant('xml'));
     ok($settings->isEnabledVariant('curl'));
     ok($settings->isEnabledVariant('zip'));
     ok($settings->isEnabledVariant('openssl'));
 }
예제 #3
0
 function testZeroValue()
 {
     $arg = new Argument('0');
     not_ok($arg->isShortOption());
     not_ok($arg->isLongOption());
     not_ok($arg->isEmpty());
 }
예제 #4
0
 public function testSetQuiet()
 {
     $make = new MakeTask($this->createLogger(), new OptionResult());
     not_ok($make->isQuiet());
     $make->setQuiet();
     ok($make->isQuiet());
 }
예제 #5
0
 function testExcept()
 {
     $v = new ValidationKit\StringValidator(array('except' => 'aaa'));
     ok($v);
     ok($v->validate('Find the position of the first occurrence of a substring in a string'));
     not_ok($v->validate('Find the aaa of the first occurrence of a substring in a string'));
 }
예제 #6
0
 public function testRemoveVariant()
 {
     $settings = new BuildSettings();
     $settings->enableVariant('sqlite', true);
     ok($settings->hasVariant('sqlite'));
     $settings->removeVariant('sqlite');
     not_ok($settings->hasVariant('sqlite'));
 }
 function test()
 {
     $v = new ValidationKit\PasswordValidator(array('with_digits' => true, 'max_length' => 10, 'min_length' => 3));
     ok($v);
     ok($v->validate('123nnn'));
     not_ok($v->validate('11'));
     not_ok($v->validate(md5(123)));
 }
 function testStringLength()
 {
     $v = new ValidationKit\StringLengthValidator(array('min' => 5, 'max' => 10));
     ok($v);
     not_ok($v->validate(str_repeat('x', 3)));
     ok($v->validate(str_repeat('x', 10)));
     not_ok($v->validate(str_repeat('x', 11)));
 }
예제 #9
0
 public function testIndexedArrayCheck()
 {
     $a = array(0 => 'foo', 1 => 'bar');
     ok(LazyRecord\ArrayUtils::is_indexed_array($a));
     $a = array('a' => 'foo', 1 => 'bar');
     not_ok(LazyRecord\ArrayUtils::is_indexed_array($a));
     $a = array('a' => 'foo', 1 => 'bar');
     not_ok(LazyRecord\ArrayUtils::is_indexed_array($a));
 }
예제 #10
0
 /**
  * test email validator
  */
 function test()
 {
     $validator = new ValidationKit\EmailValidator();
     ok($validator->validate('*****@*****.**'));
     ok($validator->validate('*****@*****.**'));
     ok($validator->validate('*****@*****.**'));
     not_ok($validator->validate('cornelius.howl@test'));
     not_ok($validator->validate('co.jp'));
 }
 function testNonDash()
 {
     $validator = new ValidationKit\PhoneNumber\TWPhoneNumberValidator();
     ok($validator);
     ok($validator->validate('0975123123'));
     not_ok($validator->validate('06-237000344'));
     not_ok($validator->validate('0975-123123'));
     not_ok($validator->validate('06-'));
     ok($validator->validate('110'));
 }
예제 #12
0
 /**
  * Range testing
  */
 function test()
 {
     $v = new RangeValidator(array('>' => 10, '<' => 20));
     not_ok($v->validate(10));
     ok($v->validate(11));
     ok($v->validate(19));
     ok($v->validate(19.2));
     not_ok($v->validate('test'));
     not_ok($v->validate('123'));
 }
 function test()
 {
     $v = new ValidationKit\TW\IDNumberValidator();
     ok($v);
     ok($v->validate('A136411883'));
     ok($v->validate('A178161208'));
     ok($v->validate('A157354749'));
     ok($v->validate('I155729562'));
     not_ok($v->validate('BBBB'));
     not_ok($v->validate('B123456789'));
 }
function flickr_photos_search_facet_range(&$query, $facet, $start, $end, $gap, $more = array())
{
    if (!$GLOBALS['cfg']['enable_feature_solr']) {
        return not_ok('search indexing is disabled');
    }
    $defaults = array('viewer_id' => 0);
    $more = array_merge($defaults, $more);
    $q = solr_utils_hash2query($query, " AND ");
    $params = array('q' => $q, "facet.range" => $facet, "facet.range.gap" => $gap, "facet.range.start" => $start, "facet.range.end" => $end);
    $owner_id = isset($query['user_id']) ? $query['user_id'] : 0;
    if ($fq = _flickr_photos_search_perms_fq($owner_id, $more['viewer_id'], $more)) {
        $params['fq'] = $fq;
    }
    return solr_facet_range($params, $more);
}
예제 #15
0
파일: tap.php 프로젝트: rintaun/PGModel
function is_not($left, $right, $message = null)
{
    $ret = not_ok($left === $right, $message);
    if (!$ret) {
        notate("got '{$left}', should be not be '{$right}'");
    }
    return $ret;
}