-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update composer minimum php >= 8.0 Update composer phpunit versions Update composer psr log to v2 or v3 Fix usort() returning bool from comparison function is deprecated Fix phpunit 8 tests Fix phpunit 8 deprecated tests Fix phpunit 8 the attribute 'syntaxCheck' is not allowed Fix tests need build dir Fix readme examples * Add github workflow * Fix build dir must be present for tests to succeed * Updated php versions for automated testing * Fix tests
- Loading branch information
Showing
16 changed files
with
127 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ jobs: | |
strategy: | ||
matrix: | ||
php-version: | ||
- "5.3" | ||
- "8.0" | ||
- "8.1" | ||
|
||
dependencies: | ||
- "highest" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ composer.phar | |
/build/ | ||
phpunit.xml | ||
TODO | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,8 @@ Feel free to comment, send pull requests and patches... | |
Basic usage ~ *standalone* | ||
----------- | ||
```php | ||
use Apix\Log; | ||
|
||
$urgent_logger = new Logger\Mail('[email protected]'); | ||
$urgent_logger = new Apix\Log\Logger\Mail('[email protected]'); | ||
$urgent_logger->setMinLevel('critical'); // catch logs >= to `critical` | ||
``` | ||
|
||
|
@@ -49,7 +48,7 @@ Advanced usage ~ *multi-logs dispatcher* | |
-------------- | ||
Lets create an additional logger with purpose of catching log entries that have a severity level of `warning` or more -- see the [log levels](#log-levels) for the order. | ||
```php | ||
$app_logger = new Logger\File('/var/log/apix_app.log'); | ||
$app_logger = new Apix\Log\Logger\File('/var/log/apix_app.log'); | ||
$app_logger->setMinLevel('warning') // intercept logs that are >= `warning` | ||
->setCascading(false) // don't propagate to further buckets | ||
->setDeferred(true); // postpone/accumulate logs processing | ||
|
@@ -59,13 +58,13 @@ $app_logger->setMinLevel('warning') // intercept logs that are >= `warning` | |
Now, lets create a main logger object and inject the two previous loggers. | ||
```php | ||
// The main logger object (injecting an array of loggers) | ||
$logger = new Logger( array($urgent_logger, $app_logger) ); | ||
$logger = new Apix\Log\Logger( array($urgent_logger, $app_logger) ); | ||
``` | ||
Lets create an additional logger -- just for development/debug purposes. | ||
```php | ||
if(DEBUG) { | ||
// Bucket for the remaining logs -- i.e. `notice`, `info` and `debug` | ||
$dev_logger = new Logger\Stream(); // default to screen without output buffer | ||
$dev_logger = new Apix\Log\Logger\Stream(); // default to screen without output buffer | ||
// $dev_logger = new Logger\File('/tmp/apix_debug.log'); | ||
$dev_logger->setMinLevel('debug'); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
bootstrap="tests/bootstrap.php" | ||
> | ||
<testsuites> | ||
<testsuite name="Apix Log Unit Tests"> | ||
<directory suffix="Test.php">tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory>./</directory> | ||
<exclude> | ||
<directory>build</directory> | ||
<directory>tests</directory> | ||
<directory>vendor</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
|
||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage> | ||
<include> | ||
<directory>./</directory> | ||
</include> | ||
<exclude> | ||
<directory>build</directory> | ||
<directory>tests</directory> | ||
<directory>vendor</directory> | ||
</exclude> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="Apix Log Unit Tests"> | ||
<directory suffix="Test.php">tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> | ||
|
||
<!-- vim: set tabstop=4 shiftwidth=4 expandtab: --> | ||
<!-- vim: set tabstop=4 shiftwidth=4 expandtab: --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,34 +8,31 @@ | |
* @license http://opensource.org/licenses/BSD-3-Clause New BSD License | ||
*/ | ||
|
||
namespace Apix\Log\tests\Logger; | ||
namespace Apix\Log; | ||
|
||
use Apix\Log\Logger; | ||
use Apix\Log; | ||
use Psr\Log\InvalidArgumentException; | ||
use PHPUnit\Framework\Assert; | ||
|
||
class MailTest extends \PHPUnit_Framework_TestCase | ||
class MailTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
|
||
/** | ||
* @expectedException Psr\Log\InvalidArgumentException | ||
* @expectedExceptionMessage "" is an invalid email address | ||
*/ | ||
public function testThrowsInvalidArgumentExceptionWhenNull() | ||
{ | ||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('"" is an invalid email address'); | ||
new Logger\Mail(null); | ||
} | ||
|
||
/** | ||
* @expectedException Psr\Log\InvalidArgumentException | ||
* @expectedExceptionMessage "foo" is an invalid email address | ||
*/ | ||
public function testThrowsInvalidArgumentException() | ||
{ | ||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('"foo" is an invalid email address'); | ||
new Logger\Mail('foo'); | ||
} | ||
|
||
public function testConstructor() | ||
{ | ||
new Logger\Mail('[email protected]', 'CC: [email protected]'); | ||
$this->assertTrue(true); | ||
} | ||
|
||
} |
Oops, something went wrong.