Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webbasics
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
webbasics
Commits
bb17d386
Commit
bb17d386
authored
Jul 15, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added unit test for Logger::save().
parent
9b2c2614
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
tests/test_logger.php
tests/test_logger.php
+11
-0
No files found.
tests/test_logger.php
View file @
bb17d386
...
@@ -5,6 +5,7 @@ use WebBasics\Logger;
...
@@ -5,6 +5,7 @@ use WebBasics\Logger;
define
(
'NAME'
,
'Testlogger'
);
define
(
'NAME'
,
'Testlogger'
);
define
(
'FORMAT'
,
'%(level): %(message)'
);
define
(
'FORMAT'
,
'%(level): %(message)'
);
define
(
'LOGFILE'
,
'build/temp.log'
);
class
LoggerTest
extends
PHPUnit_Extensions_OutputTestCase
{
class
LoggerTest
extends
PHPUnit_Extensions_OutputTestCase
{
function
setUp
()
{
function
setUp
()
{
...
@@ -108,6 +109,16 @@ class LoggerTest extends PHPUnit_Extensions_OutputTestCase {
...
@@ -108,6 +109,16 @@ class LoggerTest extends PHPUnit_Extensions_OutputTestCase {
$this
->
logger
->
handle_exception
(
new
Exception
(
'test message'
));
$this
->
logger
->
handle_exception
(
new
Exception
(
'test message'
));
$this
->
assertNotEquals
(
$this
->
logger
->
dumps
(),
''
);
$this
->
assertNotEquals
(
$this
->
logger
->
dumps
(),
''
);
}
}
function
test_save
()
{
$this
->
logger
->
warning
(
'test message'
);
$this
->
logger
->
save
(
LOGFILE
);
$this
->
assertStringEqualsFile
(
LOGFILE
,
'WARNING: test message'
);
$this
->
logger
->
warning
(
'another test message'
);
$this
->
logger
->
save
(
LOGFILE
);
$this
->
assertStringEqualsFile
(
LOGFILE
,
"WARNING: test message
\n
WARNING: another test message"
);
file_exists
(
LOGFILE
)
&&
unlink
(
LOGFILE
);
}
}
}
?>
?>
\ No newline at end of file
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