1- <?php declare (strict_types = 1 );
1+ <?php declare (strict_types= 1 );
22/**
33 * This file is part of the TelegramBotManager package.
44 *
@@ -32,10 +32,10 @@ class BotManagerTest extends \PHPUnit\Framework\TestCase
3232 public static function setUpBeforeClass ()
3333 {
3434 self ::$ live_params = [
35- 'api_key ' => getenv ('API_KEY ' ),
36- 'botname ' => getenv ('BOTNAME ' ),
37- 'secret ' => 'super-secret ' ,
38- 'mysql ' => [
35+ 'api_key ' => getenv ('API_KEY ' ),
36+ 'bot_username ' => getenv ('BOT_USERNAME ' ),
37+ 'secret ' => 'super-secret ' ,
38+ 'mysql ' => [
3939 'host ' => PHPUNIT_DB_HOST ,
4040 'database ' => PHPUNIT_DB_NAME ,
4141 'user ' => PHPUNIT_DB_USER ,
@@ -77,7 +77,7 @@ public function testNoVitalsFail()
7777 */
7878 public function testSomeVitalsFail ()
7979 {
80- new BotManager (['api_key ' => '12345:api_key ' , 'botname ' => 'testbot ' ]);
80+ new BotManager (['api_key ' => '12345:api_key ' , 'bot_username ' => 'testbot ' ]);
8181 }
8282
8383 public function testVitalsSuccess ()
@@ -92,7 +92,7 @@ public function testValidTelegramObject()
9292 $ telegram = $ bot ->getTelegram ();
9393
9494 self ::assertInstanceOf (Telegram::class, $ telegram );
95- self ::assertSame (ParamsTest::$ demo_vital_params ['botname ' ], $ telegram ->getBotName ());
95+ self ::assertSame (ParamsTest::$ demo_vital_params ['bot_username ' ], $ telegram ->getBotUsername ());
9696 self ::assertSame (ParamsTest::$ demo_vital_params ['api_key ' ], $ telegram ->getApiKey ());
9797 }
9898
@@ -158,31 +158,31 @@ public function testValidateAndSetWebhookSuccess()
158158 $ botManager ,
159159 'telegram ' ,
160160 $ this ->getMockBuilder (Telegram::class)
161- ->disableOriginalConstructor ()
162- ->setMethods (['setWebhook ' , 'deleteWebhook ' , 'getDescription ' ])
163- ->getMock ()
161+ ->disableOriginalConstructor ()
162+ ->setMethods (['setWebhook ' , 'deleteWebhook ' , 'getDescription ' ])
163+ ->getMock ()
164164 );
165165
166166 $ telegram = $ botManager ->getTelegram ();
167167
168168 /** @var \PHPUnit_Framework_MockObject_MockObject $telegram */
169169 $ telegram ->expects (static ::any ())
170- ->method ('setWebhook ' )
171- ->with ('https://web/hook.php?a=handle&s=secret_12345 ' )
172- ->will (static ::returnSelf ());
170+ ->method ('setWebhook ' )
171+ ->with ('https://web/hook.php?a=handle&s=secret_12345 ' )
172+ ->will (static ::returnSelf ());
173173 $ telegram ->expects (static ::any ())
174- ->method ('deleteWebhook ' )
175- ->will (static ::returnSelf ());
174+ ->method ('deleteWebhook ' )
175+ ->will (static ::returnSelf ());
176176 $ telegram ->expects (static ::any ())
177- ->method ('getDescription ' )
178- ->will (static ::onConsecutiveCalls (
179- 'Webhook was set ' , // set
180- 'Webhook is already set ' ,
181- 'Webhook was deleted ' , // reset
182- 'Webhook was set ' ,
183- 'Webhook was deleted ' , //unset
184- 'Webhook is already deleted '
185- ));
177+ ->method ('getDescription ' )
178+ ->will (static ::onConsecutiveCalls (
179+ 'Webhook was set ' , // set
180+ 'Webhook is already set ' ,
181+ 'Webhook was deleted ' , // reset
182+ 'Webhook was set ' ,
183+ 'Webhook was deleted ' , //unset
184+ 'Webhook is already deleted '
185+ ));
186186
187187 TestHelpers::setObjectProperty ($ botManager ->getAction (), 'action ' , 'set ' );
188188 $ output = $ botManager ->validateAndSetWebhook ()->getOutput ();
0 commit comments