本文整理汇总了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);
示例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();