-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amended PR: Add listen new config param "minimum_level" error log. #46
base: master
Are you sure you want to change the base?
Changes from all commits
cfc99a1
dcb9ffe
1cec8e1
6aed6c7
37be9b5
671f09a
702eed9
8662829
b586218
1d30418
a0ddb06
c2c4e16
4322bdc
c94df2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Rollbar\Symfony\RollbarBundle\Tests\Factories; | ||
|
||
use Rollbar\Config; | ||
use Rollbar\Defaults; | ||
use Psr\Log\LogLevel; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Rollbar\Symfony\RollbarBundle\DependencyInjection\RollbarExtension; | ||
use Rollbar\Symfony\RollbarBundle\Factories\RollbarHandlerFactory; | ||
use Rollbar\Rollbar; | ||
use Rollbar\Payload\Level; | ||
|
||
/** | ||
* Class RollbarHandlerFactoryTest | ||
* | ||
* @package Rollbar\Symfony\RollbarBundle\Tests\Factories; | ||
*/ | ||
class RollbarHandlerFactoryTest extends KernelTestCase | ||
{ | ||
public static function setUpBeforeClass() | ||
{ | ||
self::bootKernel(); | ||
} | ||
|
||
public function testMinimumLevel() | ||
{ | ||
$factory = new RollbarHandlerFactory(self::$container); | ||
|
||
$getAccessTokenMethod = new \ReflectionMethod('\Rollbar\RollbarLogger', 'getAccessToken'); | ||
$getAccessTokenMethod->setAccessible(true); | ||
$accessToken = $getAccessTokenMethod->invoke(Rollbar::logger()); | ||
|
||
$mockLogger = $this->getMockBuilder('\Rollbar\RollbarLogger') | ||
->setConstructorArgs(array(array( | ||
'access_token' => $accessToken, | ||
'minimum_level' => LogLevel::ERROR | ||
))) | ||
->getMock(); | ||
|
||
$rollbarClass = new \ReflectionClass('\Rollbar\Rollbar'); | ||
$setLoggerMethod = $rollbarClass->getMethod('setLogger'); | ||
$setLoggerMethod->setAccessible(true); | ||
$setLoggerMethod->invoke(null, $mockLogger); | ||
|
||
$logger = self::$container->get('test_alias.logger'); | ||
|
||
$mockLogger->expects($this->once()) | ||
->method('log') | ||
->with($this->equalTo(Level::ERROR)); | ||
|
||
$logger->log(Level::ERROR, "Test info from the factory test"); | ||
|
||
$logger->log(Level::INFO, "Test debug from the factory test"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
rollbar: | ||
enabled: true | ||
access_token: ~ # pulled from phpunit.xml | ||
environment: 'rollbar-php-symfony-test-app' | ||
minimum_level: 'info' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add an empty line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the reason this PR was never merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this change made? Seems completely unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The head is here:
Change:
Because there are errors above the error equation, but in the config, lib has params minimum erorr level log.