@@ -2815,6 +2815,36 @@ public function testCacheMessageStoreCanBeConfiguredWithCustomTtl()
28152815 $ this ->assertTrue ($ cacheMessageStoreDefinition ->hasTag ('ai.message_store ' ));
28162816 }
28172817
2818+ public function testMeilisearchMessageStoreIsConfigured ()
2819+ {
2820+ $ container = $ this ->buildContainer ([
2821+ 'ai ' => [
2822+ 'message_store ' => [
2823+ 'meilisearch ' => [
2824+ 'custom ' => [
2825+ 'endpoint ' => 'http://127.0.0.1:7700 ' ,
2826+ 'api_key ' => 'foo ' ,
2827+ 'index_name ' => 'test ' ,
2828+ ],
2829+ ],
2830+ ],
2831+ ],
2832+ ]);
2833+
2834+ $ meilisearchMessageStoreDefinition = $ container ->getDefinition ('ai.message_store.meilisearch.custom ' );
2835+
2836+ $ this ->assertTrue ($ meilisearchMessageStoreDefinition ->isLazy ());
2837+ $ this ->assertSame ('http://127.0.0.1:7700 ' , $ meilisearchMessageStoreDefinition ->getArgument (0 ));
2838+ $ this ->assertSame ('foo ' , $ meilisearchMessageStoreDefinition ->getArgument (1 ));
2839+ $ this ->assertInstanceOf (Reference::class, $ meilisearchMessageStoreDefinition ->getArgument (2 ));
2840+ $ this ->assertSame (ClockInterface::class, (string ) $ meilisearchMessageStoreDefinition ->getArgument (2 ));
2841+ $ this ->assertSame ('test ' , $ meilisearchMessageStoreDefinition ->getArgument (3 ));
2842+
2843+ $ this ->assertTrue ($ meilisearchMessageStoreDefinition ->hasTag ('proxy ' ));
2844+ $ this ->assertSame ([['interface ' => MessageStoreInterface::class]], $ meilisearchMessageStoreDefinition ->getTag ('proxy ' ));
2845+ $ this ->assertTrue ($ meilisearchMessageStoreDefinition ->hasTag ('ai.message_store ' ));
2846+ }
2847+
28182848 public function testMemoryMessageStoreCanBeConfiguredWithCustomKey ()
28192849 {
28202850 $ container = $ this ->buildContainer ([
@@ -2839,34 +2869,122 @@ public function testMemoryMessageStoreCanBeConfiguredWithCustomKey()
28392869 $ this ->assertTrue ($ memoryMessageStoreDefinition ->hasTag ('ai.message_store ' ));
28402870 }
28412871
2842- public function testMeilisearchMessageStoreIsConfigured ()
2872+ public function testPogocacheMessageStoreIsConfigured ()
28432873 {
28442874 $ container = $ this ->buildContainer ([
28452875 'ai ' => [
28462876 'message_store ' => [
2847- 'meilisearch ' => [
2877+ 'pogocache ' => [
28482878 'custom ' => [
2849- 'endpoint ' => 'http://127.0.0.1:7700 ' ,
2850- 'api_key ' => 'foo ' ,
2851- 'index_name ' => 'test ' ,
2879+ 'endpoint ' => 'http://127.0.0.1:9401 ' ,
2880+ 'password ' => 'foo ' ,
2881+ 'key ' => 'bar ' ,
28522882 ],
28532883 ],
28542884 ],
28552885 ],
28562886 ]);
28572887
2858- $ meilisearchMessageStoreDefinition = $ container ->getDefinition ('ai.message_store.meilisearch .custom ' );
2888+ $ pogocacheMessageStoreDefinition = $ container ->getDefinition ('ai.message_store.pogocache .custom ' );
28592889
2860- $ this ->assertTrue ($ meilisearchMessageStoreDefinition ->isLazy ());
2861- $ this ->assertSame ( ' http://127.0.0.1:7700 ' , $ meilisearchMessageStoreDefinition ->getArgument (0 ));
2862- $ this ->assertSame ('foo ' , $ meilisearchMessageStoreDefinition ->getArgument (1 ));
2863- $ this ->assertInstanceOf (Reference::class , $ meilisearchMessageStoreDefinition ->getArgument (2 ));
2864- $ this ->assertSame (ClockInterface::class, ( string ) $ meilisearchMessageStoreDefinition ->getArgument (2 ));
2865- $ this ->assertSame ('test ' , $ meilisearchMessageStoreDefinition ->getArgument (3 ));
2890+ $ this ->assertTrue ($ pogocacheMessageStoreDefinition ->isLazy ());
2891+ $ this ->assertInstanceOf (Reference::class , $ pogocacheMessageStoreDefinition ->getArgument (0 ));
2892+ $ this ->assertSame ('http_client ' , ( string ) $ pogocacheMessageStoreDefinition ->getArgument (0 ));
2893+ $ this ->assertSame ( ' http://127.0.0.1:9401 ' , $ pogocacheMessageStoreDefinition ->getArgument (1 ));
2894+ $ this ->assertSame (' foo ' , $ pogocacheMessageStoreDefinition ->getArgument (2 ));
2895+ $ this ->assertSame ('bar ' , $ pogocacheMessageStoreDefinition ->getArgument (3 ));
28662896
2867- $ this ->assertTrue ($ meilisearchMessageStoreDefinition ->hasTag ('proxy ' ));
2868- $ this ->assertSame ([['interface ' => MessageStoreInterface::class]], $ meilisearchMessageStoreDefinition ->getTag ('proxy ' ));
2869- $ this ->assertTrue ($ meilisearchMessageStoreDefinition ->hasTag ('ai.message_store ' ));
2897+ $ this ->assertTrue ($ pogocacheMessageStoreDefinition ->hasTag ('proxy ' ));
2898+ $ this ->assertSame ([['interface ' => MessageStoreInterface::class]], $ pogocacheMessageStoreDefinition ->getTag ('proxy ' ));
2899+ $ this ->assertTrue ($ pogocacheMessageStoreDefinition ->hasTag ('ai.message_store ' ));
2900+ }
2901+
2902+ public function testRedisMessageStoreIsConfigured ()
2903+ {
2904+ $ container = $ this ->buildContainer ([
2905+ 'ai ' => [
2906+ 'message_store ' => [
2907+ 'redis ' => [
2908+ 'custom ' => [
2909+ 'endpoint ' => 'http://127.0.0.1:9401 ' ,
2910+ 'index_name ' => 'foo ' ,
2911+ 'connection_parameters ' => [
2912+ 'foo ' => 'bar ' ,
2913+ ],
2914+ ],
2915+ ],
2916+ ],
2917+ ],
2918+ ]);
2919+
2920+ $ redisMessageStoreDefinition = $ container ->getDefinition ('ai.message_store.redis.custom ' );
2921+
2922+ $ this ->assertTrue ($ redisMessageStoreDefinition ->isLazy ());
2923+ $ this ->assertInstanceOf (Definition::class, $ redisMessageStoreDefinition ->getArgument (0 ));
2924+ $ this ->assertSame (\Redis::class, $ redisMessageStoreDefinition ->getArgument (0 )->getClass ());
2925+ $ this ->assertSame ('foo ' , $ redisMessageStoreDefinition ->getArgument (1 ));
2926+ $ this ->assertInstanceOf (Reference::class, $ redisMessageStoreDefinition ->getArgument (2 ));
2927+ $ this ->assertSame ('serializer ' , (string ) $ redisMessageStoreDefinition ->getArgument (2 ));
2928+
2929+ $ this ->assertTrue ($ redisMessageStoreDefinition ->hasTag ('proxy ' ));
2930+ $ this ->assertSame ([['interface ' => MessageStoreInterface::class]], $ redisMessageStoreDefinition ->getTag ('proxy ' ));
2931+ $ this ->assertTrue ($ redisMessageStoreDefinition ->hasTag ('ai.message_store ' ));
2932+ }
2933+
2934+ public function testRedisMessageStoreIsConfiguredWithCustomClient ()
2935+ {
2936+ $ container = $ this ->buildContainer ([
2937+ 'ai ' => [
2938+ 'message_store ' => [
2939+ 'redis ' => [
2940+ 'custom ' => [
2941+ 'endpoint ' => 'http://127.0.0.1:9401 ' ,
2942+ 'index_name ' => 'foo ' ,
2943+ 'client ' => 'custom.redis ' ,
2944+ ],
2945+ ],
2946+ ],
2947+ ],
2948+ ]);
2949+
2950+ $ redisMessageStoreDefinition = $ container ->getDefinition ('ai.message_store.redis.custom ' );
2951+
2952+ $ this ->assertTrue ($ redisMessageStoreDefinition ->isLazy ());
2953+ $ this ->assertInstanceOf (Reference::class, $ redisMessageStoreDefinition ->getArgument (0 ));
2954+ $ this ->assertSame ('custom.redis ' , (string ) $ redisMessageStoreDefinition ->getArgument (0 ));
2955+ $ this ->assertSame ('foo ' , $ redisMessageStoreDefinition ->getArgument (1 ));
2956+ $ this ->assertInstanceOf (Reference::class, $ redisMessageStoreDefinition ->getArgument (2 ));
2957+ $ this ->assertSame ('serializer ' , (string ) $ redisMessageStoreDefinition ->getArgument (2 ));
2958+
2959+ $ this ->assertTrue ($ redisMessageStoreDefinition ->hasTag ('proxy ' ));
2960+ $ this ->assertSame ([['interface ' => MessageStoreInterface::class]], $ redisMessageStoreDefinition ->getTag ('proxy ' ));
2961+ $ this ->assertTrue ($ redisMessageStoreDefinition ->hasTag ('ai.message_store ' ));
2962+ }
2963+
2964+ public function testSessionMessageStoreIsConfigured ()
2965+ {
2966+ $ container = $ this ->buildContainer ([
2967+ 'ai ' => [
2968+ 'message_store ' => [
2969+ 'session ' => [
2970+ 'custom ' => [
2971+ 'identifier ' => 'foo ' ,
2972+ ],
2973+ ],
2974+ ],
2975+ ],
2976+ ]);
2977+
2978+ $ sessionMessageStoreDefinition = $ container ->getDefinition ('ai.message_store.session.custom ' );
2979+
2980+ $ this ->assertTrue ($ sessionMessageStoreDefinition ->isLazy ());
2981+ $ this ->assertInstanceOf (Reference::class, $ sessionMessageStoreDefinition ->getArgument (0 ));
2982+ $ this ->assertSame ('request_stack ' , (string ) $ sessionMessageStoreDefinition ->getArgument (0 ));
2983+ $ this ->assertSame ('foo ' , (string ) $ sessionMessageStoreDefinition ->getArgument (1 ));
2984+
2985+ $ this ->assertTrue ($ sessionMessageStoreDefinition ->hasTag ('proxy ' ));
2986+ $ this ->assertSame ([['interface ' => MessageStoreInterface::class]], $ sessionMessageStoreDefinition ->getTag ('proxy ' ));
2987+ $ this ->assertTrue ($ sessionMessageStoreDefinition ->hasTag ('ai.message_store ' ));
28702988 }
28712989
28722990 private function buildContainer (array $ configuration ): ContainerBuilder
0 commit comments