当前位置: 首页>>代码示例>>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;未经允许,请勿转载。