Skip to content

Commit

Permalink
Merge pull request #54 from zzgab/feature-52-multiple-redis
Browse files Browse the repository at this point in the history
storage areas for multiple redis servers
  • Loading branch information
omansour authored Oct 30, 2016
2 parents 8b7e6db + f61105d commit a869f53
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 148 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ $myRedisMock = $factory->getAdapter('My\Redis\Library');

*Note : the factory will throw an exception by default if your parent class implements unsupported commands. If you want even so partially use the mock, you can specify the second parameter when you build it `$factory->getAdapter('My\Redis\Library', true)`. The exception will then thrown only when the command is called.*

### Static storage & Multiple servers
The storage in the RedisMock class is organized by named areas. The default area's name is the empty string `''` but you can
specify an alternate area name when calling the factory's `getAdapter` method.

````php
getAdapter($classToExtend, $failOnlyAtRuntime = false, $ignoreConstructor = true, $storage = '')
````

This enables the mocking of several remote Redis servers, each one with its own storage area.

However, one same area remains statically shared across all the instances bound to it.

## Tests

The development environment is provided by Vagrant and the [Xotelia box](https://github.com/Xotelia/VagrantBox).
Expand Down
Loading

0 comments on commit a869f53

Please sign in to comment.