Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
0e31ad8b
Commit
0e31ad8b
authored
May 26, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix and test
parent
d00daf9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
4 deletions
+63
-4
TelegramLog.php
src/TelegramLog.php
+4
-4
TelegramLogTest.php
tests/Unit/TelegramLogTest.php
+59
-0
No files found.
src/TelegramLog.php
View file @
0e31ad8b
...
...
@@ -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
)
{
...
...
tests/Unit/TelegramLogTest.php
0 → 100644
View file @
0e31ad8b
<?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
(
''
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment