From e6ed8a30171b86b452cec21a283373fc14dd5330 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Tue, 19 Sep 2017 19:33:24 +0200 Subject: Changed LogEntries table: Use log level instead of nick name --- test/Logger/EngelsystemLoggerTest.php | 7 ++++++- test/model/LogEntriesModelTest.php | 29 ++++++++++++----------------- test/model/RoomModelTest.php | 17 +++++++---------- 3 files changed, 25 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/Logger/EngelsystemLoggerTest.php b/test/Logger/EngelsystemLoggerTest.php index da10800d..2219cdb2 100644 --- a/test/Logger/EngelsystemLoggerTest.php +++ b/test/Logger/EngelsystemLoggerTest.php @@ -66,7 +66,7 @@ class EngelsystemLoggerTest extends TestCase $entry = $this->getLastEntry(); $this->assertEquals('My username is Foo', $entry['message']); - $this->assertContains(LogLevel::INFO, $entry['nick'], '', true); + $this->assertEquals(LogLevel::INFO, $entry['level']); foreach ( [ @@ -123,4 +123,9 @@ class EngelsystemLoggerTest extends TestCase return $entry; } + + public function tearDown() + { + LogEntries_clear_all(); + } } diff --git a/test/model/LogEntriesModelTest.php b/test/model/LogEntriesModelTest.php index 25d46fc4..761725c4 100644 --- a/test/model/LogEntriesModelTest.php +++ b/test/model/LogEntriesModelTest.php @@ -1,37 +1,32 @@ assertNotFalse(LogEntry_create('test', 'test_LogEntry_create')); - + $this->assertNotFalse(LogEntry_create(LogLevel::WARNING, 'test_LogEntry_create')); + // There should be one more log entry now $this->assertEquals(count(LogEntries()), $count + 1); } - public function test_LogEntries_clear_all() + public function testClearAllLogEntries() { - $this->create_LogEntry(); + LogEntry_create(LogLevel::WARNING, 'test'); $this->assertTrue(count(LogEntries()) > 0); + $this->assertNotFalse(LogEntries_clear_all()); - $this->assertEquals(count(LogEntries()), 0); + $this->assertCount(0, LogEntries()); } - /** - * @after - */ - public function teardown() + public function tearDown() { LogEntries_clear_all(); } diff --git a/test/model/RoomModelTest.php b/test/model/RoomModelTest.php index 135a6108..4205845b 100644 --- a/test/model/RoomModelTest.php +++ b/test/model/RoomModelTest.php @@ -1,11 +1,11 @@ create_Room(); - + $room = Room($this->room_id); - + $this->assertNotFalse($room); $this->assertNotNull($room); $this->assertEquals($room['Name'], 'test'); - - $this->assertNull(Room(- 1)); + + $this->assertNull(Room(-1)); } - /** - * @after - */ - public function teardown() + public function tearDown() { if ($this->room_id != null) { Room_delete($this->room_id); -- cgit v1.2.3-54-g00ecf