Commit 0e31ad8b authored by MBoretto's avatar MBoretto

fix and test

parent d00daf9e
......@@ -10,7 +10,7 @@
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Longman\TelegramBot\Exception\TelegramLogException;
use TelegramBot\Exception\TelegramLogException;
namespace Longman\TelegramBot;
......@@ -86,7 +86,7 @@ class TelegramLog
public static function initErrorLog($path)
{
if (empty($path)) {
throw new TelegramLogException('Empty path for error log');
throw new \Longman\TelegramBot\Exception\TelegramLogException('Empty path for error log');
}
self::initialize();
self::$error_log_path = $path;
......@@ -103,7 +103,7 @@ class TelegramLog
public static function initDebugLog($path)
{
if (empty($path)) {
throw new TelegramLogException('Empty path for debug log');
throw new \Longman\TelegramBot\Exception\TelegramLogException('Empty path for debug log');
}
self::initialize();
self::$debug_log_path = $path;
......@@ -121,7 +121,7 @@ class TelegramLog
public static function initUpdateLog($path)
{
if (empty($path)) {
throw new TelegramLogException('Empty path for update log');
throw new \Longman\TelegramBot\Exception\TelegramLogException('Empty path for update log');
}
self::$update_log_path = $path;
if (self::$monolog_update === null) {
......
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\Unit;
use Longman\TelegramBot\TelegramLog;
use Longman\TelegramBot\Exception\TelegramLogException;
/**
* @package TelegramTest
* @author Avtandil Kikabidze <akalongman@gmail.com>
* @copyright Avtandil Kikabidze <akalongman@gmail.com>
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
* @link http://www.github.com/akalongman/php-telegram-bot
*/
class TelegramLogTest extends TestCase
{
/**
* setUp
*/
protected function setUp()
{
}
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
*/
public function newInstanceWithoutErrorPath()
{
TelegramLog::initErrorLog('');
}
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
*/
public function newInstanceWithoutDebugPath()
{
TelegramLog::initDebugLog('');
}
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
*/
public function newInstanceWithoutUpdatePath()
{
TelegramLog::initUpdateLog('');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment