Returns the development server profile.
public static getDevelopment ( ) : Predis\Profile\ProfileInterface | ||
return | Predis\Profile\ProfileInterface |
/** * @group disconnected */ public function testGetDevelopment() { $profile1 = Factory::get('dev'); $profile2 = Factory::getDevelopment(); $this->assertInstanceOf('Predis\\Profile\\ProfileInterface', $profile1); $this->assertInstanceOf('Predis\\Profile\\ProfileInterface', $profile2); $this->assertEquals(self::DEVELOPMENT_PROFILE_VERSION, $profile2->getVersion()); }
/** * @group disconnected */ public function testSettingCustomCommandHandler() { $strategy = $this->getClusterStrategy(); $profile = Profile\Factory::getDevelopment(); $callable = $this->getMock('stdClass', array('__invoke')); $callable->expects($this->once())->method('__invoke')->with($this->isInstanceOf('Predis\\Command\\CommandInterface'))->will($this->returnValue('key')); $strategy->setCommandHandler('get', $callable); $command = $profile->createCommand('get', array('key')); $this->assertNotNull($strategy->getSlot($command)); }
/** * @group disconnected */ public function testSetLuaScriptAsReadOperation() { $strategy = new ReplicationStrategy(); $profile = Profile\Factory::getDevelopment(); $writeScript = 'redis.call("set", "foo", "bar")'; $readScript = 'return true'; $strategy->setScriptReadOnly($readScript, true); $cmdEval = $profile->createCommand('EVAL', array($writeScript)); $cmdEvalSHA = $profile->createCommand('EVALSHA', array(sha1($writeScript))); $this->assertFalse($strategy->isReadOperation($cmdEval)); $this->assertFalse($strategy->isReadOperation($cmdEvalSHA)); $cmdEval = $profile->createCommand('EVAL', array($readScript)); $cmdEvalSHA = $profile->createCommand('EVALSHA', array(sha1($readScript))); $this->assertTrue($strategy->isReadOperation($cmdEval)); $this->assertTrue($strategy->isReadOperation($cmdEvalSHA)); }
public function testClientsAliased() { $params = $this->getSomeParameters(); $app = $this->register(array( 'predis.clients' => array( '1st' => "{$params['scheme']}://{$params['host']}:{$params['port']}", '2nd' => $params, '3rd' => array('parameters' => $params), '4th' => array('parameters' => $params, 'options' => array('profile' => 'dev')), ) )); $this->checkParameters($app['predis'], '1st', $params); $this->checkParameters($app['predis'], '2nd', $params); $this->checkParameters($app['predis'], '3rd', $params); $this->checkParameters($app['predis'], '4th', $params); list(, $options) = $this->getParametersAndOptions($app['predis']['1st']); $this->assertEquals(ProfileFactory::getDefault(), $options->profile); list(, $options) = $this->getParametersAndOptions($app['predis']['2nd']); $this->assertEquals(ProfileFactory::getDefault(), $options->profile); list(, $options) = $this->getParametersAndOptions($app['predis']['3rd']); $this->assertEquals(ProfileFactory::getDefault(), $options->profile); list(, $options) = $this->getParametersAndOptions($app['predis']['4th']); $this->assertEquals(ProfileFactory::getDevelopment(), $options->profile); }