summaryrefslogtreecommitdiff
path: root/tests/Feature/Logger/EngelsystemLoggerTest.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-31 01:55:05 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-31 03:24:54 +0200
commitac48332166ce28fcb1a2fc130c7f5adbc760e42d (patch)
tree1ff076a6a1c5a35b4ad73477d60cbcb77ebfd922 /tests/Feature/Logger/EngelsystemLoggerTest.php
parent9d9aa71eb736885f23c069a75c7a047b06434178 (diff)
Models: Added LogEntry model
Diffstat (limited to 'tests/Feature/Logger/EngelsystemLoggerTest.php')
-rw-r--r--tests/Feature/Logger/EngelsystemLoggerTest.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/Feature/Logger/EngelsystemLoggerTest.php b/tests/Feature/Logger/EngelsystemLoggerTest.php
index ce7b8ac5..9ec078a3 100644
--- a/tests/Feature/Logger/EngelsystemLoggerTest.php
+++ b/tests/Feature/Logger/EngelsystemLoggerTest.php
@@ -3,6 +3,7 @@
namespace Engelsystem\Test\Feature\Logger;
use Engelsystem\Logger\EngelsystemLogger;
+use Engelsystem\Models\LogEntry;
use Engelsystem\Test\Feature\ApplicationFeatureTest;
use Psr\Log\InvalidArgumentException;
use Psr\Log\LoggerInterface;
@@ -15,12 +16,13 @@ class EngelsystemLoggerTest extends ApplicationFeatureTest
*/
public function getLogger()
{
- return new EngelsystemLogger();
+ $logEntry = new LogEntry();
+ return new EngelsystemLogger($logEntry);
}
public function testImplements()
{
- $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
+ $this->assertInstanceOf(LoggerInterface::class, $this->getLogger());
}
/**
@@ -46,21 +48,20 @@ class EngelsystemLoggerTest extends ApplicationFeatureTest
*/
public function testAllLevels($level)
{
+ LogEntry::query()->truncate();
$logger = $this->getLogger();
- LogEntries_clear_all();
-
$logger->log($level, 'First log message');
$logger->{$level}('Second log message');
- $entries = LogEntries();
+ $entries = LogEntry::all();
$this->assertCount(2, $entries);
}
public function testContextReplacement()
{
+ LogEntry::query()->truncate();
$logger = $this->getLogger();
- LogEntries_clear_all();
$logger->log(LogLevel::INFO, 'My username is {username}', ['username' => 'Foo']);
@@ -100,8 +101,8 @@ class EngelsystemLoggerTest extends ApplicationFeatureTest
public function testContextToString()
{
+ LogEntry::query()->truncate();
$logger = $this->getLogger();
- LogEntries_clear_all();
$mock = $this->getMockBuilder('someDataProvider')
->setMethods(['__toString'])
@@ -132,14 +133,14 @@ class EngelsystemLoggerTest extends ApplicationFeatureTest
*/
public function getLastEntry()
{
- $entries = LogEntries();
- $entry = array_pop($entries);
+ $entries = LogEntry::all();
+ $entry = $entries->last();
return $entry;
}
public function tearDown()
{
- LogEntries_clear_all();
+ LogEntry::query()->truncate();
}
}