This repository was archived by the owner on Oct 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,22 +108,31 @@ public function getSubscriptions()
108108 /**
109109 * Constructor.
110110 *
111- * @param ConnectionOptions $options Connection options object.
112- * @param StreamWrapper $streamWrapper Wrapper for stream functions. Testing purposes.
111+ * @param ConnectionOptions $options Connection options object.
113112 */
114- public function __construct (ConnectionOptions $ options = null , StreamWrapper $ streamWrapper = null )
113+ public function __construct (ConnectionOptions $ options = null )
115114 {
116115 $ this ->pings = 0 ;
117116 $ this ->pubs = 0 ;
118117 $ this ->subscriptions = [];
119118 $ this ->options = $ options ;
120- $ this ->streamWrapper = $ streamWrapper ;
119+ $ this ->streamWrapper = new StreamWrapper ();
120+
121121 if (is_null ($ options )) {
122122 $ this ->options = new ConnectionOptions ();
123123 }
124- if (is_null ($ streamWrapper )) {
125- $ this ->streamWrapper = new StreamWrapper ();
126- }
124+ }
125+
126+ /**
127+ * Setter for $streamWrapper. For testing purposes.
128+ *
129+ * @param StreamWrapper $streamWrapper StreamWrapper for testing purposes.
130+ *
131+ * @return void
132+ */
133+ public function setStreamWrapper (StreamWrapper $ streamWrapper )
134+ {
135+ $ this ->streamWrapper = $ streamWrapper ;
127136 }
128137
129138 /**
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ public function setUp()
5252
5353 $ streamWrapper ->setStreamTimeout (Argument::any (), Argument::any ())->willReturn (true );
5454
55- $ this ->c = new Nats \Connection ($ options , $ streamWrapper ->reveal ());
55+ $ this ->c = new Nats \Connection ($ options );
56+ $ this ->c ->setStreamWrapper ($ streamWrapper ->reveal ());
5657 $ this ->c ->connect ();
5758 }
5859
You can’t perform that action at this time.
0 commit comments