@@ -17,11 +17,22 @@ public function testFooConnectionDefinition()
17
17
18
18
$ this ->assertTrue ($ container ->has ('old_sound_rabbit_mq.connection.foo_connection ' ));
19
19
$ definition = $ container ->getDefinition ('old_sound_rabbit_mq.connection.foo_connection ' );
20
- $ this ->assertEquals ('foo_host ' , $ definition ->getArgument (0 ));
21
- $ this ->assertEquals (123 , $ definition ->getArgument (1 ));
22
- $ this ->assertEquals ('foo_user ' , $ definition ->getArgument (2 ));
23
- $ this ->assertEquals ('foo_password ' , $ definition ->getArgument (3 ));
24
- $ this ->assertEquals ('/foo ' , $ definition ->getArgument (4 ));
20
+ $ this ->assertTrue ($ container ->has ('old_sound_rabbit_mq.connection_factory.foo_connection ' ));
21
+ $ factory = $ container ->getDefinition ('old_sound_rabbit_mq.connection_factory.foo_connection ' );
22
+ $ this ->assertEquals ('old_sound_rabbit_mq.connection_factory.foo_connection ' , $ definition ->getFactoryService ());
23
+ $ this ->assertEquals (array (
24
+ 'host ' => 'foo_host ' ,
25
+ 'port ' => 123 ,
26
+ 'user ' => 'foo_user ' ,
27
+ 'password ' => 'foo_password ' ,
28
+ 'vhost ' => '/foo ' ,
29
+ 'lazy ' => false ,
30
+ 'connection_timeout ' => 3 ,
31
+ 'read_write_timeout ' => 3 ,
32
+ 'ssl_context ' => array (),
33
+ 'keepalive ' => null ,
34
+ 'heartbeat ' => 0 ,
35
+ ), $ factory ->getArgument (1 ));
25
36
$ this ->assertEquals ('%old_sound_rabbit_mq.connection.class% ' , $ definition ->getClass ());
26
37
}
27
38
@@ -31,18 +42,24 @@ public function testSslConnectionDefinition()
31
42
32
43
$ this ->assertTrue ($ container ->has ('old_sound_rabbit_mq.connection.ssl_connection ' ));
33
44
$ definition = $ container ->getDefinition ('old_sound_rabbit_mq.connection.ssl_connection ' );
34
- $ this ->assertEquals ('ssl_host ' , $ definition ->getArgument (0 ));
35
- $ this ->assertEquals (123 , $ definition ->getArgument (1 ));
36
- $ this ->assertEquals ('ssl_user ' , $ definition ->getArgument (2 ));
37
- $ this ->assertEquals ('ssl_password ' , $ definition ->getArgument (3 ));
38
- $ this ->assertEquals ('/ssl ' , $ definition ->getArgument (4 ));
39
-
40
- $ context = $ definition ->getArgument (11 );
41
- $ this ->assertInternalType ('resource ' , $ context );
42
- $ this ->assertEquals ('stream-context ' , get_resource_type ($ context ));
43
- $ options = stream_context_get_options ($ context );
44
- $ this ->assertEquals (array ('ssl ' => array ('verify_peer ' => false )), $ options );
45
-
45
+ $ this ->assertTrue ($ container ->has ('old_sound_rabbit_mq.connection_factory.ssl_connection ' ));
46
+ $ factory = $ container ->getDefinition ('old_sound_rabbit_mq.connection_factory.ssl_connection ' );
47
+ $ this ->assertEquals ('old_sound_rabbit_mq.connection_factory.ssl_connection ' , $ definition ->getFactoryService ());
48
+ $ this ->assertEquals (array (
49
+ 'host ' => 'ssl_host ' ,
50
+ 'port ' => 123 ,
51
+ 'user ' => 'ssl_user ' ,
52
+ 'password ' => 'ssl_password ' ,
53
+ 'vhost ' => '/ssl ' ,
54
+ 'lazy ' => false ,
55
+ 'connection_timeout ' => 3 ,
56
+ 'read_write_timeout ' => 3 ,
57
+ 'ssl_context ' => array (
58
+ 'verify_peer ' => false ,
59
+ ),
60
+ 'keepalive ' => null ,
61
+ 'heartbeat ' => 0 ,
62
+ ), $ factory ->getArgument (1 ));
46
63
$ this ->assertEquals ('%old_sound_rabbit_mq.connection.class% ' , $ definition ->getClass ());
47
64
}
48
65
@@ -52,11 +69,22 @@ public function testLazyConnectionDefinition()
52
69
53
70
$ this ->assertTrue ($ container ->has ('old_sound_rabbit_mq.connection.lazy_connection ' ));
54
71
$ definition = $ container ->getDefinition ('old_sound_rabbit_mq.connection.lazy_connection ' );
55
- $ this ->assertEquals ('lazy_host ' , $ definition ->getArgument (0 ));
56
- $ this ->assertEquals (456 , $ definition ->getArgument (1 ));
57
- $ this ->assertEquals ('lazy_user ' , $ definition ->getArgument (2 ));
58
- $ this ->assertEquals ('lazy_password ' , $ definition ->getArgument (3 ));
59
- $ this ->assertEquals ('/lazy ' , $ definition ->getArgument (4 ));
72
+ $ this ->assertTrue ($ container ->has ('old_sound_rabbit_mq.connection_factory.lazy_connection ' ));
73
+ $ factory = $ container ->getDefinition ('old_sound_rabbit_mq.connection_factory.lazy_connection ' );
74
+ $ this ->assertEquals ('old_sound_rabbit_mq.connection_factory.lazy_connection ' , $ definition ->getFactoryService ());
75
+ $ this ->assertEquals (array (
76
+ 'host ' => 'lazy_host ' ,
77
+ 'port ' => 456 ,
78
+ 'user ' => 'lazy_user ' ,
79
+ 'password ' => 'lazy_password ' ,
80
+ 'vhost ' => '/lazy ' ,
81
+ 'lazy ' => true ,
82
+ 'connection_timeout ' => 3 ,
83
+ 'read_write_timeout ' => 3 ,
84
+ 'ssl_context ' => array (),
85
+ 'keepalive ' => null ,
86
+ 'heartbeat ' => 0 ,
87
+ ), $ factory ->getArgument (1 ));
60
88
$ this ->assertEquals ('%old_sound_rabbit_mq.lazy.connection.class% ' , $ definition ->getClass ());
61
89
}
62
90
@@ -66,11 +94,22 @@ public function testDefaultConnectionDefinition()
66
94
67
95
$ this ->assertTrue ($ container ->has ('old_sound_rabbit_mq.connection.default ' ));
68
96
$ definition = $ container ->getDefinition ('old_sound_rabbit_mq.connection.default ' );
69
- $ this ->assertEquals ('localhost ' , $ definition ->getArgument (0 ));
70
- $ this ->assertEquals (5672 , $ definition ->getArgument (1 ));
71
- $ this ->assertEquals ('guest ' , $ definition ->getArgument (2 ));
72
- $ this ->assertEquals ('guest ' , $ definition ->getArgument (3 ));
73
- $ this ->assertEquals ('/ ' , $ definition ->getArgument (4 ));
97
+ $ this ->assertTrue ($ container ->has ('old_sound_rabbit_mq.connection_factory.default ' ));
98
+ $ factory = $ container ->getDefinition ('old_sound_rabbit_mq.connection_factory.default ' );
99
+ $ this ->assertEquals ('old_sound_rabbit_mq.connection_factory.default ' , $ definition ->getFactoryService ());
100
+ $ this ->assertEquals (array (
101
+ 'host ' => 'localhost ' ,
102
+ 'port ' => 5672 ,
103
+ 'user ' => 'guest ' ,
104
+ 'password ' => 'guest ' ,
105
+ 'vhost ' => '/ ' ,
106
+ 'lazy ' => false ,
107
+ 'connection_timeout ' => 3 ,
108
+ 'read_write_timeout ' => 3 ,
109
+ 'ssl_context ' => array (),
110
+ 'keepalive ' => null ,
111
+ 'heartbeat ' => 0 ,
112
+ ), $ factory ->getArgument (1 ));
74
113
$ this ->assertEquals ('%old_sound_rabbit_mq.connection.class% ' , $ definition ->getClass ());
75
114
}
76
115
0 commit comments