From 3cc831856733aece275d0fa71f0c8def744ffbdc Mon Sep 17 00:00:00 2001 From: Levi Date: Sat, 26 Nov 2016 18:38:14 -0500 Subject: [PATCH] Test setting the logFormat and logFilename properties --- tests/otherLogClassesTest.php | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/otherLogClassesTest.php diff --git a/tests/otherLogClassesTest.php b/tests/otherLogClassesTest.php new file mode 100644 index 0000000..5d4c7ef --- /dev/null +++ b/tests/otherLogClassesTest.php @@ -0,0 +1,44 @@ +assertInstanceOf('wappr\Contracts\LogFilenameInterface', $logFilename); + $this->assertInstanceOf('wappr\Contracts\LogFormatInterface', $logFormat); + + $logger->setLogFilename($logFilename); + $logger->setLogFormat($logFormat); + + $result = $logger->debug('A horse is a dog.'); + $this->assertNull($result); + + $logs = $filesystem->read(date('Y-m-d').'.log'); // read the logs into a string + + $log = explode("\n", $logs); // explode the string by newline into an array + + $numberOfLines = count($log); // get the number of indexes in the array + unset($log[$numberOfLines - 1]); // take off the last line / last index of the array + + $containHorse = false; + + if (strpos(end($log), 'cat') !== false) { + $containHorse = true; + } + + $this->assertFalse($containHorse); + } +}