@@ -56,6 +56,19 @@ private function getListener($post)
5656 return $ listener ;
5757 }
5858
59+ private function getRequest (Config $ config , $ commandPrefix )
60+ {
61+ return [
62+ 'token ' => $ config ->get (self ::VERIFICATION_TOKEN ),
63+ 'text ' => "mybot: {$ commandPrefix }ping " ,
64+ 'user_id ' => 'dummyId ' ,
65+ 'user_name ' => $ config ->get ('botUsername ' ),
66+ 'trigger_word ' => 'mybot: ' ,
67+ 'channel_id ' => 'C2147483705 ' ,
68+ 'debug ' => true ,
69+ ];
70+ }
71+
5972 /**
6073 * @throws \Exception
6174 *
@@ -71,15 +84,7 @@ public function testRun()
7184 /**
7285 * Form the request.
7386 */
74- $ request = [
75- 'token ' => $ config ->get (self ::VERIFICATION_TOKEN ),
76- 'text ' => "mybot: {$ commandPrefix }ping " ,
77- 'user_id ' => 'dummyId ' ,
78- 'user_name ' => $ config ->get ('botUsername ' ),
79- 'trigger_word ' => 'mybot: ' ,
80- 'channel_id ' => 'C2147483705 ' ,
81- 'debug ' => true ,
82- ];
87+ $ request = $ this ->getRequest ($ config , $ commandPrefix );
8388
8489 $ config ->set ('chatLogging ' , false );
8590
@@ -123,15 +128,7 @@ public function testRunWithAccessControl()
123128 /**
124129 * Form the request.
125130 */
126- $ request = [
127- 'token ' => $ config ->get (self ::VERIFICATION_TOKEN ),
128- 'text ' => "mybot: {$ commandPrefix }ping " ,
129- 'user_id ' => 'dummyId ' ,
130- 'user_name ' => $ config ->get ('botUsername ' ),
131- 'trigger_word ' => 'mybot: ' ,
132- 'channel_id ' => 'C2147483705 ' ,
133- 'debug ' => true ,
134- ];
131+ $ request = $ this ->getRequest ($ config , $ commandPrefix );
135132
136133 $ config ->set ('chatLogging ' , false );
137134
@@ -171,15 +168,7 @@ public function testRunWithBlackListedAccessControl()
171168 /**
172169 * Form the request.
173170 */
174- $ request = [
175- 'token ' => $ config ->get (self ::VERIFICATION_TOKEN ),
176- 'text ' => "mybot: {$ commandPrefix }ping " ,
177- 'user_id ' => 'dummyId ' ,
178- 'user_name ' => $ config ->get ('botUsername ' ),
179- 'trigger_word ' => 'mybot: ' ,
180- 'channel_id ' => 'C2147483705 ' ,
181- 'debug ' => true ,
182- ];
171+ $ request = $ this ->getRequest ($ config , $ commandPrefix );
183172
184173 $ config ->set ('chatLogging ' , false );
185174
0 commit comments