Skip to content

Commit

Permalink
Fix for deprecated getMonolog method (#3)
Browse files Browse the repository at this point in the history
* Fix for deprecated getMonolog method

* Update README.md
  • Loading branch information
threesquared authored Nov 5, 2018
1 parent 40835bd commit ab9ce5b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Require the package in composer:

```javascript
"require": {
"pod-point/laravel-monolog-kinesis": "^1.0"
"pod-point/laravel-monolog-kinesis": "^2.0"
},
```

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"type": "library",
"require": {
"php": ">=7.0",
"illuminate/support": "5.*",
"illuminate/support": "^5.6",
"monolog/monolog": "~1.11",
"aws/aws-sdk-php": "^3.62"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
"phpunit/phpunit": "~7.0",
"orchestra/testbench": "~3.6"
},
"license": "MIT",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function boot()
]);

if (config('kinesis.stream')) {
$monolog = Log::getMonolog();
$monolog = Log::getLogger();

$config = [
'region' => config('kinesis.aws.region'),
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class TestCase extends \PHPUnit_Framework_TestCase
class TestCase extends \PHPUnit\Framework\TestCase
{
//
}
36 changes: 36 additions & 0 deletions tests/unit/ServiceProviderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use PodPoint\KinesisLogger\Providers\ServiceProvider;
use Orchestra\Testbench\TestCase;
use PodPoint\KinesisLogger\Monolog\KinesisHandler;

class ServiceProviderTest extends TestCase
{
/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('kinesis.stream', 'stream');
$app['config']->set('kinesis.aws.region', 'region');
$app['config']->set('kinesis.aws.key', 'key');
$app['config']->set('kinesis.aws.secret', 'secret');
$app['config']->set('kinesis.level', 1);
}

/**
* Test the service provider registers the handler.
*/
public function testServiceProvider()
{
$provider = new ServiceProvider($this->app);
$provider->boot();

$monolog = Log::getLogger();

$this->assertEquals(KinesisHandler::class, get_class($monolog->popHandler()));
}
}

0 comments on commit ab9ce5b

Please sign in to comment.