GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test::Mock::Redis(3) User Contributed Perl Documentation Test::Mock::Redis(3)

Test::Mock::Redis - use in place of Redis for unit testing

Version 0.22

Test::Mock::Redis can be used in place of Redis for running tests without needing a running redis instance.

    use Test::Mock::Redis;

    my $redis = Test::Mock::Redis->new(server => 'whatever');

    $redis->set($key, 'some value');

    $redis->get($key);

    ...

This module is designed to function as a drop in replacement for Redis.pm for testing purposes.

See perldoc Redis and the redis documentation at <http://redis.io>

The "connection" to the mocked server (and its stored data) will persist beyond the object instance, just like a real Redis server. This means that you do not need to save the instance to this object in order to preserve your data; simply call "new" with the same server parameter and the same instance will be returned, with all data preserved.

    Create a new Test::Mock::Redis object.

    It can be used in place of a Redis object for unit testing.

    It accepts the "server" argument, just like Redis.pm's new.

Redis ships with a default of 16 databases, and that's what this module handles by default. If you need to change that, do

    use Test::Mock::Redis num_databases => 21;

or at run-time

    Test::Mock::Redis::change_num_databases(21);

See "PIPELINING" in Redis -- most methods support the use of a callback sub as the final argument. For this implementation, the callback sub will be called immediately (before the result of the original method is returned), and "wait_all_responses" does nothing. Combining pipelining with "multi"/"exec" is not supported.

Lots!

Not all Redis functionality is implemented. The test files that output "TODO" are still to be done.

The top of all test files [except 01-basic.t] has the list of commands tested or to-be tested in the file.

Those marked with an "x" are pretty well-tested. Those marked with an "o" need help. Those that are unmarked have no tests, or are un-implemented. For example:

x AUTH <--- has some tests

o KEYS <--- only partially tested and/or implemented

    ZINTERSTORE   <--- not tested (or maybe not implemented)

Beyond that, it would be neat to add methods to inspect how often keys were accessed and get other information that allows the module user to confirm that their code interacted with redis (or Test::Mock::Redis) as they expected.

Jeff Lavallee, "<jeff at zeroclue.com>"

The real Redis.pm client whose interface this module mimics: <http://search.cpan.org/dist/Redis>

Please report any bugs or feature requests to "bug-mock-redis at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Mock-Redis>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.

    perldoc Test::Mock::Redis

You can also look for information at:

  • RT: CPAN's request tracker

    <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Mock-Redis>

  • AnnoCPAN: Annotated CPAN documentation

    <http://annocpan.org/dist/Test-Mock-Redis>

  • CPAN Ratings

    <http://cpanratings.perl.org/d/Test-Mock-Redis>

  • Search CPAN

    <http://search.cpan.org/dist/Test-Mock-Redis/>

Salvatore Sanfilippo for redis, of course!

Dobrica Pavlinusic & Pedro Melo for Redis.pm

The following people have contributed to Test::Mock::Redis:

  • Chris Reinhardt
  • Ian Burrell
  • Gianni Ceccarelli
  • Karen Etheridge
  • Keith Broughton
  • Kevin Goess
  • Neil Bowers
  • Nigel Gregoire
  • Thomas Bloor
  • Valery Kalesnik
  • Yaakov Shaul

Copyright 2018 Jeff Lavallee.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See <http://dev.perl.org/licenses/> for more information.

2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.