Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
15 | public function test_crash(): void { |
||
16 | $plugin = new class($this) extends Plugin { |
||
17 | |||
18 | public function __construct(TestCase $testCase) { |
||
19 | Telegram::setAdminId(259760855); |
||
20 | $testCase->assertEquals(259760855, Telegram::getAdminId()); |
||
21 | } |
||
22 | |||
23 | public function __process(Update $update): void { |
||
24 | CrashPad::sendCrash( |
||
25 | Telegram::getAdminId(), |
||
26 | new \Exception('test'), |
||
27 | json_encode($update->getRawData(), JSON_PRETTY_PRINT) |
||
28 | ); |
||
29 | CrashPad::clearCrashLogs(); |
||
30 | } |
||
31 | |||
32 | }; |
||
33 | |||
34 | TelegramTest::loadEnvironment(); |
||
35 | (new UpdateHandler())-> |
||
36 | addPlugins($plugin)-> |
||
37 | resolve(Telegram::processUpdate( |
||
38 | '{"update_id":1,"message":{"message_id":1,"from":{"id":1,"is_bot":false,"first_name":"First","last_name":"Last","username":"username","language_code":"en"},"chat":{"id":1,"first_name":"First","last_name":"Last","username":"username","type":"private"},"date":1546300800,"text":"Hello World!"}}', |
||
39 | $_ENV['TELEGRAM_BOT_TOKEN'] |
||
40 | )); |
||
44 |