From 246e5a24a5ceedf364e06bb13e0a26cf46ee9507 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Sun, 10 Nov 2024 22:49:52 +0200 Subject: Add phpunit.xml --- tests/OutputDriverTest.php | 96 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/OutputDriverTest.php (limited to 'tests/OutputDriverTest.php') diff --git a/tests/OutputDriverTest.php b/tests/OutputDriverTest.php new file mode 100644 index 0000000..a650732 --- /dev/null +++ b/tests/OutputDriverTest.php @@ -0,0 +1,96 @@ +format('Y-m-d H:i:s'); + $this->expectOutputString("[{$date}] OutputDriverTest.EMERGENCY: test"); + $loggr = new Loggr(new OutputDriver()); + $loggr->emergency('test'); + } + + /** + * @throws \Exception + */ + public function testAlert(): void + { + $date = (new DateTime)->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$date}] OutputDriverTest.ALERT: test"); + $loggr = new Loggr(new OutputDriver()); + $loggr->alert('test'); + } + + /** + * @throws \Exception + */ + public function testCritical(): void + { + $date = (new DateTime)->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$date}] OutputDriverTest.CRITICAL: test"); + $loggr = new Loggr(new OutputDriver()); + $loggr->critical('test'); + } + + /** + * @throws \Exception + */ + public function testError(): void + { + $date = (new DateTime)->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$date}] OutputDriverTest.ERROR: test"); + $loggr = new Loggr(new OutputDriver()); + $loggr->error('test'); + } + + /** + * @throws \Exception + */ + public function testWarning(): void + { + $date = (new DateTime)->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$date}] OutputDriverTest.WARNING: test"); + $loggr = new Loggr(new OutputDriver()); + $loggr->warning('test'); + } + + /** + * @throws \Exception + */ + public function testNotice(): void + { + $date = (new DateTime)->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$date}] OutputDriverTest.NOTICE: test"); + $loggr = new Loggr(new OutputDriver()); + $loggr->notice('test'); + } + + /** + * @throws \Exception + */ + public function testInfo(): void + { + $date = (new DateTime)->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$date}] OutputDriverTest.INFO: test"); + $loggr = new Loggr(new OutputDriver()); + $loggr->info('test'); + } + + /** + * @throws \Exception + */ + public function testDebug(): void + { + $date = (new DateTime)->format('Y-m-d H:i:s'); + $this->expectOutputString("[{$date}] OutputDriverTest.DEBUG: test"); + $loggr = new Loggr(new OutputDriver()); + $loggr->debug('test'); + } +} \ No newline at end of file -- cgit v1.2.3