Snc\RedisBundle\Tests\Profiler\Storage\Mock\RedisMock::connect PHP Method

connect() public method

Add a server to connection pool.
public connect ( string $host, integer $port = 6379, float $timeout ) : boolean
$host string
$port integer
$timeout float
return boolean
    public function connect($host, $port = 6379, $timeout = 0)
    {
        if ('127.0.0.1' == $host && 6379 == $port) {
            $this->connected = true;
            return true;
        }
        return false;
    }

Usage Example

 protected function setUp()
 {
     $redisMock = new RedisMock();
     $redisMock->connect('127.0.0.1', 6379);
     self::$storage = new RedisProfilerStorage($redisMock, 86400);
     if (self::$storage) {
         self::$storage->purge();
     }
 }