14
14
namespace Snc \RedisBundle \Tests \DependencyInjection ;
15
15
16
16
use InvalidArgumentException ;
17
+ use Monolog \Formatter \LogstashFormatter ;
18
+ use Monolog \Handler \RedisHandler ;
17
19
use PHPUnit \Framework \TestCase ;
18
20
use Predis \Client ;
21
+ use Predis \Configuration \Options ;
22
+ use Predis \Connection \Parameters ;
19
23
use Redis ;
20
24
use RedisException ;
21
25
use Relay \Relay ;
26
+ use Snc \RedisBundle \Client \Predis \Connection \ConnectionFactory ;
27
+ use Snc \RedisBundle \Client \Predis \Connection \ConnectionWrapper ;
28
+ use Snc \RedisBundle \DataCollector \RedisDataCollector ;
22
29
use Snc \RedisBundle \DependencyInjection \Configuration \Configuration ;
23
30
use Snc \RedisBundle \DependencyInjection \SncRedisExtension ;
31
+ use Snc \RedisBundle \Logger \RedisLogger ;
24
32
use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
25
33
use Symfony \Component \Config \Definition \Processor ;
26
34
use Symfony \Component \Config \FileLocator ;
@@ -46,15 +54,15 @@ class SncRedisExtensionTest extends TestCase
46
54
public static function parameterValues (): array
47
55
{
48
56
return [
49
- ['snc_redis.client.class ' , ' Predis\ Client' ],
57
+ ['snc_redis.client.class ' , Client::class ],
50
58
['snc_redis.relay_client.class ' , Relay::class],
51
- ['snc_redis.client_options.class ' , ' Predis\Configuration\ Options' ],
52
- ['snc_redis.connection_parameters.class ' , ' Predis\Connection\ Parameters' ],
53
- ['snc_redis.connection_factory.class ' , ' Snc\RedisBundle\Client\Predis\Connection\ ConnectionFactory' ],
54
- ['snc_redis.connection_wrapper.class ' , ' Snc\RedisBundle\Client\Predis\Connection\ ConnectionWrapper' ],
55
- ['snc_redis.logger.class ' , ' Snc\RedisBundle\Logger\ RedisLogger' ],
56
- ['snc_redis.data_collector.class ' , ' Snc\RedisBundle\DataCollector\ RedisDataCollector' ],
57
- ['snc_redis.monolog_handler.class ' , ' Monolog\Handler\ RedisHandler' ],
59
+ ['snc_redis.client_options.class ' , Options::class ],
60
+ ['snc_redis.connection_parameters.class ' , Parameters::class ],
61
+ ['snc_redis.connection_factory.class ' , ConnectionFactory::class ],
62
+ ['snc_redis.connection_wrapper.class ' , ConnectionWrapper::class ],
63
+ ['snc_redis.logger.class ' , RedisLogger::class ],
64
+ ['snc_redis.data_collector.class ' , RedisDataCollector::class ],
65
+ ['snc_redis.monolog_handler.class ' , RedisHandler::class ],
58
66
];
59
67
}
60
68
@@ -193,7 +201,7 @@ public function testMonologFormatterOption(): void
193
201
{
194
202
$ container = $ this ->getContainer ();
195
203
//Create a fake formatter definition
196
- $ container ->setDefinition ('my_monolog_formatter ' , new Definition (' Monolog \\ Formatter \\ LogstashFormatter ' , ['symfony ' ]));
204
+ $ container ->setDefinition ('my_monolog_formatter ' , new Definition (LogstashFormatter::class , ['symfony ' ]));
197
205
$ extension = new SncRedisExtension ();
198
206
$ config = $ this ->parseYaml ($ this ->getMonologFormatterOptionYamlConfig ());
199
207
$ extension ->load ([$ config ], $ container );
@@ -763,7 +771,7 @@ private function getPhpRedisWithInvalidACLYamlMinimalConfig(): string
763
771
764
772
public function testPredisWithConnectionPersistentBool (): void
765
773
{
766
- if (!class_exists (' Predis\ Client' )) {
774
+ if (!class_exists (Client::class )) {
767
775
$ this ->markTestSkipped ('Predis not available ' );
768
776
}
769
777
@@ -783,7 +791,7 @@ public function testPredisWithConnectionPersistentBool(): void
783
791
784
792
public function testPredisWithConnectionPersistentString (): void
785
793
{
786
- if (!class_exists (' Predis\ Client' )) {
794
+ if (!class_exists (Client::class )) {
787
795
$ this ->markTestSkipped ('Predis not available ' );
788
796
}
789
797
@@ -803,7 +811,7 @@ public function testPredisWithConnectionPersistentString(): void
803
811
804
812
public function testPredisWithConnectionPersistentVersionTooOld (): void
805
813
{
806
- if (!class_exists (' Predis\ Client' )) {
814
+ if (!class_exists (Client::class )) {
807
815
$ this ->markTestSkipped ('Predis not available ' );
808
816
}
809
817
@@ -849,7 +857,7 @@ private function getPredisWithConnectionPersistentStringYamlConfig(): string
849
857
850
858
public function testPredisWithConnectionPersistentFalse (): void
851
859
{
852
- if (!class_exists (' Predis\ Client' )) {
860
+ if (!class_exists (Client::class )) {
853
861
$ this ->markTestSkipped ('Predis not available ' );
854
862
}
855
863
0 commit comments