當前位置: 首頁>>代碼示例>>PHP>>正文


PHP test::assert_false方法代碼示例

本文整理匯總了PHP中test::assert_false方法的典型用法代碼示例。如果您正苦於以下問題:PHP test::assert_false方法的具體用法?PHP test::assert_false怎麽用?PHP test::assert_false使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在test的用法示例。


在下文中一共展示了test::assert_false方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

$r->set('test', null);
$v = $r->get('test');
test::assert_null($v);
$v = $r->exists('test');
test::assert_true($v);
$r->set('test', true);
$v = $r->get('test');
test::assert_true($v);
$r->set('test', false);
$v = $r->get('test');
test::assert_false($v);
$r->delete('test');
$v = $r->get('test');
test::assert_null($v);
$v = $r->exists('test');
test::assert_false($v);
# Increment/decrement
$r->delete('test');
$r->set('test', 1);
$v = $r->inc('test');
test::assert_value($v, 2, 'Increment/Decrement');
$v = $r->inc('test', 10);
test::assert_value($v, 12);
$r->delete('test');
$v = $r->inc('test');
test::assert_value($v, 1);
$v = $r->inc('test');
test::assert_value($v, 2);
$r->delete('test');
$v = $r->dec('test');
test::assert_value($v, -1);
開發者ID:otengkwame,項目名稱:php-redis,代碼行數:31,代碼來源:unit.base.php

示例2: dirname

require_once dirname(__FILE__) . '/../lib/redis.php';
require_once dirname(__FILE__) . '/../lib/redis.pool.php';
require_once dirname(__FILE__) . '/../lib/redis_set.peer.php';
require_once dirname(__FILE__) . '/test.lib.php';
# Config
redis_pool::add_servers(array('master' => array('127.0.0.1', 6379)));
class mock_set_peer extends redis_set_peer
{
}
# Tests
$p = new mock_set_peer();
$p->clear('some_set');
$p->add('some_set', 1);
$p->add('some_set', 2);
test::assert_true($p->is_member('some_set', 1), 'Adding/removing');
test::assert_true($p->is_member('some_set', 2));
test::assert_false($p->is_member('some_set', 3));
test::assert_value($p->get_count('some_set'), 2);
$set = $p->get_all('some_set');
test::assert_value(count($set), 2);
test::assert_true(in_array(2, $set));
test::assert_true(in_array(1, $set));
$p->remove('some_set', 2);
test::assert_value($p->get_count('some_set'), 1);
test::assert_false($p->is_member('some_set', 2));
test::assert_true($p->is_member('some_set', 1));
$r = $p->add('some_set', 3);
test::assert_true($r);
$r = $p->add('some_set', 3);
test::assert_false($r);
test::summary();
開發者ID:otengkwame,項目名稱:php-redis,代碼行數:31,代碼來源:unit.set.peer.php


注:本文中的test::assert_false方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。