本文整理匯總了PHP中Predis\Client::shouldReceive方法的典型用法代碼示例。如果您正苦於以下問題:PHP Client::shouldReceive方法的具體用法?PHP Client::shouldReceive怎麽用?PHP Client::shouldReceive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Predis\Client
的用法示例。
在下文中一共展示了Client::shouldReceive方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFlushError
/**
* @expectedException \Exception
*
* @dataProvider kvsProvider
*
* @param KeyValueStore $kvs
* @param RedisAdapter $dummyRedisAdapter
* @param RedisClient $dummyPredis
*/
public function testFlushError(KeyValueStore $kvs, RedisAdapter $dummyRedisAdapter, RedisClient $dummyPredis)
{
$status = new Status('QUEUED');
$dummyPredis->shouldReceive('flushdb')->andReturn($status);
$kvs->flush();
}
示例2: testPersist
/**
* @dataProvider kvsProvider
*
* @param KeyValueStore $kvs
* @param RedisAdapter $dummyRedisAdapter
* @param RedisClient $dummyPredis
*/
public function testPersist(KeyValueStore $kvs, RedisAdapter $dummyRedisAdapter, RedisClient $dummyPredis)
{
$dummyPredis->shouldReceive('persist')->with('key-e')->andReturn(1);
$dummyPredis->shouldReceive('persist')->with('key-ne')->andReturn(0);
$this->assertTrue($kvs->persist('key-e'));
$this->assertFalse($kvs->persist('key-ne'));
}
示例3: tearDown
protected function tearDown()
{
$this->redisClient->shouldReceive('del')->times(1)->andReturn(1);
$this->storage->purgeList($this->fireTime);
}
示例4: testSetError
/**
* @dataProvider kvsProvider
*
* @param KeyValueStore $kvs
* @param RedisAdapter $dummyRedisAdapter
* @param RedisClient $dummyPredis
*/
public function testSetError(KeyValueStore $kvs, RedisAdapter $dummyRedisAdapter, RedisClient $dummyPredis)
{
$status = new Status('QUEUED');
$dummyPredis->shouldReceive('set')->with('key-ne', serialize('value'))->andReturn($status);
$this->assertFalse($kvs->set('key-ne', 'value'));
}