diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | composer.json | 3 | ||||
-rwxr-xr-x | example/example.php | 21 | ||||
-rw-r--r-- | phpunit.xml | 18 | ||||
-rw-r--r-- | tests/LoggerTest.php | 20 | ||||
-rw-r--r-- | tests/logs/.gitkeep | 0 |
6 files changed, 42 insertions, 26 deletions
@@ -1,7 +1,3 @@ -src/test.php -test/ -test/* -test.php - +/tests/logs/*.txt /vendor/ composer.lock
\ No newline at end of file diff --git a/composer.json b/composer.json index a24f841..f7e7a61 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,9 @@ "require": { "psr/log": "1.0.0" }, + "require-dev": { + "phpunit/phpunit": "4.0.*" + }, "license": "MIT", "authors": [ { diff --git a/example/example.php b/example/example.php deleted file mode 100755 index 4714021..0000000 --- a/example/example.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -# Should log to the same directory as this file -require dirname(__FILE__).'/../vendor/autoload.php'; - -$obj = new stdClass(); -$obj->foo = 'bar'; -$log = new Katzgrau\KLogger\Logger(dirname(__FILE__), Psr\Log\LogLevel::DEBUG); -$args1 = array('a' => array('b' => 'c'), 'd' => null, 'e' => $obj); -$args2 = NULL; - -$log->emergency('Emergency Test'); -$log->alert('Alert Test'); -$log->critical('Critical Test'); -$log->error('Error Test'); -$log->warning('Warning Test'); -$log->notice('Notice Test'); -$log->info('Info Test'); -$log->debug('Debug Test'); - -$log->info('Testing passing an array or object', $args1); diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..3a470a0 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit colors="true" + stopOnFailure="false" + bootstrap="./vendor/autoload.php" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true"> + <testsuites> + <testsuite name="common"> + <directory suffix="Test.php">tests</directory> + </testsuite> + </testsuites> + <filter> + <blacklist> + <directory>./vendor</directory> + </blacklist> + </filter> +</phpunit> diff --git a/tests/LoggerTest.php b/tests/LoggerTest.php new file mode 100644 index 0000000..ebe65d8 --- /dev/null +++ b/tests/LoggerTest.php @@ -0,0 +1,20 @@ +<?php + +use Katzgrau\KLogger\Logger; + +class LoggerTest extends PHPUnit_Framework_TestCase +{ + private $logPath; + private $logger; + + public function setUp() + { + $this->logPath = __DIR__.'/logs'; + $this->logger = new Logger($this->logPath); + } + + public function testImplementsPsr3LoggerInterface() + { + $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->logger); + } +} diff --git a/tests/logs/.gitkeep b/tests/logs/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/logs/.gitkeep |