-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sentry-feature-csp-inline-scripts
- Loading branch information
Showing
8 changed files
with
140 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor | ||
tests/logs |
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -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> |
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 |
---|---|---|
@@ -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); | ||
} | ||
} |
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 |
---|---|---|
@@ -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'; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
return array(); |