Skip to content

Commit b3fb381

Browse files
author
Andrii Afanasiev
committed
tests
1 parent d0fefeb commit b3fb381

File tree

6 files changed

+40
-12
lines changed

6 files changed

+40
-12
lines changed

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: php
2+
3+
php:
4+
- 5.6
5+
- 7.0
6+
- 7.1
7+
8+
before_install:
9+
- curl -s https://getcomposer.org/installer | php
10+
- php composer.phar install
11+
12+
script:
13+
- php -v
14+
- vendor/bin/phpcs --standard=psr2 src/ tests/ZendTwig/ tests/Fixture/
15+
- vendor/bin/phpunit -c tests
16+
17+
after_success:
18+
- bash <(curl -s https://codecov.io/bash)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"scripts": {
3333
"test": [
3434
"composer install",
35-
"./vendor/bin/phpcs --standard=psr2 src/",
35+
"./vendor/bin/phpcs --standard=psr2 src/ tests/",
3636
"./vendor/bin/phpunit -c tests/"
3737
]
3838
}

tests/Fixtures/ErrorHandler.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ public function setAssert($assert = null)
4646
*/
4747
protected function write(array $record)
4848
{
49-
$closure = empty($this->assert) ? function() {} : $this->assert;
49+
$dummy = function () {
50+
};
51+
52+
$closure = empty($this->assert) ? $dummy : $this->assert;
5053
call_user_func($closure, $record);
5154
}
5255
}

tests/Fixtures/app/AppKernel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Tests\Fixtures\App;
4+
35
use Symfony\Component\HttpKernel\Kernel;
46
use Symfony\Component\Config\Loader\LoaderInterface;
57

tests/SymfonyRollbarBundle/DependencyInjection/SymfonyRollbarExtensionTest.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
55
use SymfonyRollbarBundle\DependencyInjection\SymfonyRollbarExtension;
6+
use SymfonyRollbarBundle\EventListener\ErrorListener;
7+
use SymfonyRollbarBundle\EventListener\ExceptionListener;
8+
use SymfonyRollbarBundle\Payload\Generator;
9+
use SymfonyRollbarBundle\Provider\RollbarHandler;
610

711
/**
812
* Class SymfonyRollbarExtensionTest
@@ -16,16 +20,16 @@ class SymfonyRollbarExtensionTest extends AbstractExtensionTestCase
1620
*/
1721
protected function getContainerExtensions()
1822
{
19-
return array(
20-
new SymfonyRollbarExtension()
21-
);
23+
return [
24+
new SymfonyRollbarExtension(),
25+
];
2226
}
2327

2428
/**
2529
* @dataProvider generatorConfigVars
2630
*
2731
* @param string $var
28-
* @param mixed $value
32+
* @param mixed $value
2933
*/
3034
public function testConfigEnabledVars($var, $value)
3135
{
@@ -37,10 +41,10 @@ public function testConfigEnabledVars($var, $value)
3741
public function generatorConfigVars()
3842
{
3943
return [
40-
['symfony_rollbar.event_listener.exception_listener.class', \SymfonyRollbarBundle\EventListener\ExceptionListener::class],
41-
['symfony_rollbar.event_listener.error_listener.class', \SymfonyRollbarBundle\EventListener\ErrorListener::class],
42-
['symfony_rollbar.provider.rollbar_handler.class', \SymfonyRollbarBundle\Provider\RollbarHandler::class],
43-
['symfony_rollbar.payload.generator.class', \SymfonyRollbarBundle\Payload\Generator::class],
44+
['symfony_rollbar.event_listener.exception_listener.class', ExceptionListener::class],
45+
['symfony_rollbar.event_listener.error_listener.class', ErrorListener::class],
46+
['symfony_rollbar.provider.rollbar_handler.class', RollbarHandler::class],
47+
['symfony_rollbar.payload.generator.class', Generator::class],
4448
['symfony_rollbar.config', ['enable' => true]],
4549
];
4650
}
@@ -51,7 +55,7 @@ public function generatorConfigVars()
5155
* @expectedException \PHPUnit_Framework_ExpectationFailedException
5256
*
5357
* @param string $var
54-
* @param mixed $value
58+
* @param mixed $value
5559
*/
5660
public function testConfigDisabledVars($var, $value)
5761
{

tests/SymfonyRollbarBundle/EventListener/ExceptionListenerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public function testException()
3030
$eventDispatcher = $container->get('event_dispatcher');
3131
$exception = new \Exception('This is new exception');
3232
$event = new GetResponseForExceptionEvent(
33-
static::$kernel, new Request(),
33+
static::$kernel,
34+
new Request(),
3435
HttpKernelInterface::MASTER_REQUEST,
3536
$exception
3637
);

0 commit comments

Comments
 (0)