Skip to content

Fix path assignment for download and upload paths #1162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Deprecated
### Removed
### Fixed
- Ensure download and upload path variables are defined.
### Security

## [0.70.0] - 2020-12-21
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ class Telegram
*
* @var string
*/
protected $upload_path;
protected $upload_path = '';

/**
* Download path
*
* @var string
*/
protected $download_path;
protected $download_path = '';

/**
* MySQL integration
Expand Down
16 changes: 14 additions & 2 deletions tests/Unit/TelegramTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
use Longman\TelegramBot\TelegramLog;

/**
* @package TelegramTest
* @link https://github.com/php-telegram-bot/core
* @author Avtandil Kikabidze <[email protected]>
* @copyright Avtandil Kikabidze <[email protected]>
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
* @link https://github.com/php-telegram-bot/core
* @package TelegramTest
*/
class TelegramTest extends TestCase
{
Expand Down Expand Up @@ -133,6 +133,18 @@ public function testAddCustomCommandsPaths(): void
self::assertCount(4, $tg->getCommandsPaths());
}

public function testSettingDownloadUploadPaths(): void
{
self::assertEmpty($this->telegram->getDownloadPath());
self::assertEmpty($this->telegram->getUploadPath());

$this->telegram->setDownloadPath('/down/below');
$this->telegram->setUploadPath('/up/above');

self::assertSame('/down/below', $this->telegram->getDownloadPath());
self::assertSame('/up/above', $this->telegram->getUploadPath());
}

public function testGetCommandsList(): void
{
$commands = $this->telegram->getCommandsList();
Expand Down