public function testClientProfileOption() { $extension = new SncRedisExtension(); $config = $this->parseYaml($this->getFullYamlConfig()); $extension->load(array($config), $container = new ContainerBuilder()); $options = $container->getDefinition('snc_redis.client.default_options')->getArgument(0); $this->assertSame((double) 2, $config['clients']['default']['options']['profile'], 'Profile version 2.0 was parsed as float'); $this->assertSame('2.0', $options['profile'], 'Profile option was converted to a string'); }
/** * Test valid config of the replication option */ public function testClientReplicationOption() { $extension = new SncRedisExtension(); $config = $this->parseYaml($this->getReplicationYamlConfig()); $extension->load(array($config), $container = $this->getContainer()); $options = $container->getDefinition('snc_redis.client.default_options')->getArgument(0); $this->assertTrue($options['replication']); $parameters = $container->getDefinition('snc_redis.default')->getArgument(0); $this->assertEquals('snc_redis.connection.master_parameters', (string) $parameters[0]); $masterParameters = $container->getDefinition((string) $parameters[0])->getArgument(0); $this->assertTrue($masterParameters['replication']); }
/** * Test valid parsing of the client profile option */ public function testClientProfileOption() { $extension = new SncRedisExtension(); $config = $this->parseYaml($this->getFullYamlConfig()); $extension->load(array($config), $container = new ContainerBuilder()); $profileDefinition = $container->getDefinition('snc_redis.client.default_profile'); $options = $container->getDefinition('snc_redis.client.default_options')->getArgument(0); $this->assertSame((double) 2, $config['clients']['default']['options']['profile'], 'Profile version 2.0 was parsed as float'); $this->assertSame('Predis\\Profile\\ServerVersion20', $profileDefinition->getClass(), 'Profile definition is instance of Predis\\Profile\\ServerVersion20'); $this->assertSame('snc:', $options['prefix'], 'Prefix option was allowed'); }