Skip to content

Commit f3e7790

Browse files
authored
Merge pull request #1162 from noplanman/fix-download-upload-paths
Fix path assignment for download and upload paths
2 parents 7ecda69 + 89248c3 commit f3e7790

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
1111
### Deprecated
1212
### Removed
1313
### Fixed
14+
- Ensure download and upload path variables are defined.
1415
### Security
1516

1617
## [0.70.0] - 2020-12-21

src/Telegram.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ class Telegram
9090
*
9191
* @var string
9292
*/
93-
protected $upload_path;
93+
protected $upload_path = '';
9494

9595
/**
9696
* Download path
9797
*
9898
* @var string
9999
*/
100-
protected $download_path;
100+
protected $download_path = '';
101101

102102
/**
103103
* MySQL integration

tests/Unit/TelegramTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
use Longman\TelegramBot\TelegramLog;
1919

2020
/**
21-
* @package TelegramTest
21+
* @link https://github.com/php-telegram-bot/core
2222
* @author Avtandil Kikabidze <[email protected]>
2323
* @copyright Avtandil Kikabidze <[email protected]>
2424
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
25-
* @link https://github.com/php-telegram-bot/core
25+
* @package TelegramTest
2626
*/
2727
class TelegramTest extends TestCase
2828
{
@@ -133,6 +133,18 @@ public function testAddCustomCommandsPaths(): void
133133
self::assertCount(4, $tg->getCommandsPaths());
134134
}
135135

136+
public function testSettingDownloadUploadPaths(): void
137+
{
138+
self::assertEmpty($this->telegram->getDownloadPath());
139+
self::assertEmpty($this->telegram->getUploadPath());
140+
141+
$this->telegram->setDownloadPath('/down/below');
142+
$this->telegram->setUploadPath('/up/above');
143+
144+
self::assertSame('/down/below', $this->telegram->getDownloadPath());
145+
self::assertSame('/up/above', $this->telegram->getUploadPath());
146+
}
147+
136148
public function testGetCommandsList(): void
137149
{
138150
$commands = $this->telegram->getCommandsList();

0 commit comments

Comments
 (0)