Skip to content

Commit

Permalink
Merge branch 'master' into sentry-feature-csp-inline-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
markushausammann committed Oct 20, 2018
2 parents e5f5b4f + 9b42711 commit b82d10f
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
tests/logs
36 changes: 36 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
language: php
sudo: false

jobs:
include:
- stage: Unit tests
env:
php: 7.0
- env: COMPOSER_FLAGS="--prefer-lowest"
php: 7.0
- env:
php: 7.1
- env: COMPOSER_FLAGS="--prefer-lowest"
php: 7.1
- env:
php: 7.2
- env: COMPOSER_FLAGS="--prefer-lowest"
php: 7.2
- env:
php: 7.3
- env: COMPOSER_FLAGS="--prefer-lowest"
php: 7.3

before_install:
- composer self-update

install:
- composer update -o $COMPOSER_FLAGS

script:
- ./vendor/bin/phpunit

cache:
directories:
- vendor
- $HOME/.composer/cache
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
A Zend Framework 3 module that lets you log exceptions, errors or whatever you wish to the Sentry.io service.

Scrutizier analysis: [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/build.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloud-solutions/zend-sentry/?branch=master) [![Build Status](https://travis-ci.org/cloud-solutions/zend-sentry.svg?branch=master)](https://travis-ci.org/cloud-solutions/zend-sentry)

ZendSentry is released under the MIT License.

Expand Down
13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@
}
],
"require": {
"php": "^5.6 || ^7.0",
"sentry/sentry": "^1.9.2"
"php": ">=7.0",
"sentry/sentry": "^1.9.2",
"zendframework/zend-eventmanager": "^2.5|| ^3.0",
"zendframework/zend-mvc": "^2.5 || ^3.0",
"zendframework/zend-log": "^2.5 || ^3.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.5"
},
"conflict": {
"zendframework/zendframework": "<3.0.0"
},
"autoload": {
"psr-0": {
"ZendSentry": "src/"
"ZendSentry": "src/",
"ZendSentryTests": "tests/"
},
"classmap": [
"./Module.php"
Expand Down
26 changes: 26 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<phpunit bootstrap="./tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
stopOnFailure="false"
processIsolation="false"
>
<testsuite name="ZendSentry test suite">
<directory>./tests/ZendSentryTest</directory>
</testsuite>


<filter>
<whitelist>
<directory suffix=".php">./src</directory>
<file>./../Module.php</file>
</whitelist>
</filter>

<logging>
<log type="coverage-text" target="php://stdout"/>
<log type="coverage-clover" target="tests/logs/clover.xml"/>
</logging>
</phpunit>
45 changes: 45 additions & 0 deletions tests/ZendSentryTest/ModuleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace ZendSentryTest;

use PHPUnit\Framework\TestCase;
use Zend\Loader\StandardAutoloader;
use ZendSentry\Module as ZendSentryModule;

class ModuleTest extends TestCase
{
/**
* @var ZendSentryModule
*/
private $module;

public function setUp()
{
parent::setUp();
$this->module = new ZendSentryModule();
}

public function testDefaultModuleConfig()
{
$expectedConfig = [];

$actualConfig = $this->module->getConfig();

$this->assertEquals($expectedConfig, $actualConfig);
}

public function testAutoloaderConfig()
{
$expectedConfig = [
StandardAutoloader::class => [
'namespaces' => [
'ZendSentry' => realpath(__DIR__.'/../../src/ZendSentry')
]
]
];

$actualConfig = $this->module->getAutoloaderConfig();

$this->assertEquals($expectedConfig, $actualConfig);
}
}
18 changes: 18 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

chdir(__DIR__);

$loader = null;
if (file_exists('../vendor/autoload.php')) {
$loader = include '../vendor/autoload.php';
} elseif (file_exists('../../../autoload.php')) {
$loader = include '../../../autoload.php';
} else {
throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
}

$loader->add('ZendSentryTest', __DIR__);

if (!$config = @include 'configuration.php') {
$config = require 'configuration.php.dist';
}
2 changes: 2 additions & 0 deletions tests/configuration.php.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
return array();

0 comments on commit b82d10f

Please sign in to comment.