Skip to content
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

V4: Requiring PHP 7.2+ and supports new versions of Symfony #84

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: php
before_script:
- phpenv config-add travis-config.ini
- wget http://getcomposer.org/composer.phar
- php composer.phar install --dev
- composer install
php:
- 5.5
- 5.6
- 7.0
- 7.2
- 7.3
- 7.4
script: phpunit
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name":"enygma/expose",
"version": "4.0.0",
"type":"library",
"description":"An intrusion detection library based on PHPIDS",
"keywords":["ids","intrusion","detection"],
Expand All @@ -13,13 +14,13 @@
}
],
"require":{
"php":">=5.3.1",
"twig/twig": "1.*|2.*",
"monolog/monolog": "~1.4",
"symfony/console": "~2.1|~3.0"
"php":">=7.2",
"twig/twig": "~3.0",
"monolog/monolog": "~2.0",
"symfony/console": "~2.1|~3.0|~4.0|~5.0"
},
"require-dev" : {
"phpunit/phpunit": "3.7.*",
"phpunit/phpunit": "7.*",
"squizlabs/php_codesniffer": "1.*",
"phpmd/phpmd": "dev-master"
},
Expand Down
10 changes: 8 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
convertNoticesToExceptions="true"
mapTestClassNameToCoveredClassName="true"
bootstrap="vendor/autoload.php"
strict="true"
verbose="true"
colors="true">
<testsuites>
<testsuite name="expose">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<exclude>
<file>src/autoload.php</file>
</exclude>
</whitelist>
</filter>
</phpunit>
4 changes: 3 additions & 1 deletion src/Expose/Queue/Mongo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Expose\Queue;

use MongoDB\Driver\Manager;

class Mongo extends \Expose\Queue
{
/**
Expand All @@ -24,7 +26,7 @@ class Mongo extends \Expose\Queue
public function getAdapter()
{
if ($this->adapter === null) {
$this->setAdapter(new \MongoClient());
$this->setAdapter(new Manager());
}
return $this->adapter;
}
Expand Down
6 changes: 4 additions & 2 deletions tests/ConverterConvertSQLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Expose\Converter;

class ConvertSQLTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

class ConvertSQLTest extends TestCase
{

/**
Expand All @@ -12,7 +14,7 @@ class ConvertSQLTest extends \PHPUnit_Framework_TestCase
*/
public function testConvertFromSQLKeywordsWithNull()
{
$converter = new \Expose\Converter\ConvertSQL();
$converter = new ConvertSQL();
$this->assertEquals($converter->convertFromSQLKeywords('SELECT 1,null;'), 'SELECT 1,0;');
$this->assertEquals($converter->convertFromSQLKeywords('SELECT 1, null;'), 'SELECT 1,0;');
}
Expand Down
14 changes: 14 additions & 0 deletions tests/Expose/Console/Command/FilterCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Expose\Console\Command;

use PHPUnit\Framework\TestCase;

class FilterCommandTest extends TestCase
{
public function testConstructor()
{
$tst = new FilterCommand("tst1");
$this->assertInstanceOf('Expose\Console\Command\FilterCommand', $tst);
}
}
25 changes: 25 additions & 0 deletions tests/Expose/Queue/MongoTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Expose\Queue;

use MongoDB\Driver\Manager;
use PHPUnit\Framework\TestCase;

class MongoTest extends TestCase
{

/**
* @var Mongo
*/
private $test;

protected function setUp(): void
{
$this->test = new Mongo();
}

public function testGetAdapter()
{
$this->assertInstanceOf(Manager::class, $this->test->getAdapter());
}
}
10 changes: 6 additions & 4 deletions tests/FilterCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

namespace Expose;

class FilterConnectionTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

class FilterConnectionTest extends TestCase
{
/**
* @var \Expose\FilterCollection
*/
private $collection = null;

public function setUp()
public function setUp(): void
{
$this->collection = new FilterCollection();
}
Expand All @@ -26,7 +28,7 @@ public function testGetSetFilterData()
array('id' => 1234)
);

$filter = new \Expose\Filter();
$filter = new Filter();
$filter->setId(1234);

$this->collection->setFilterData($data);
Expand All @@ -46,7 +48,7 @@ public function testGetFilterDataWithId() {
array('id' => 1234)
);

$filter = new \Expose\Filter();
$filter = new Filter();
$filter->setId(1234);

$this->collection->setFilterData($data);
Expand Down
28 changes: 15 additions & 13 deletions tests/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

namespace Expose;

class FilterTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

class FilterTest extends TestCase
{
private $filter = null;

public function setUp()
public function setUp(): void
{
$this->filter = new \Expose\Filter();
$this->filter = new Filter();
}

/**
* Test the getter/setter for impact value
*
*
* @covers \Expose\Filter::setImpact
* @covers \Expose\Filter::getImpact
*/
Expand All @@ -29,7 +31,7 @@ public function testGetSetImpact()

/**
* Test the getter/setter for the tag value
*
*
* @covers \Expose\Filter::setTags
* @covers \Expose\Filter::getTags
*/
Expand All @@ -45,7 +47,7 @@ public function testGetSetTags()

/**
* Test the getter/setter for the description
*
*
* @covers \Expose\Filter::setDescription
* @covers \Expose\Filter::getDescription
*/
Expand All @@ -61,7 +63,7 @@ public function testGetSetDescription()

/**
* Test the getter/setter for the ID
*
*
* @covers \Expose\Filter::setId
* @covers \Expose\Filter::getId
*/
Expand All @@ -77,7 +79,7 @@ public function testGetSetId()

/**
* Test the gettet/setter for the regex rule
*
*
* @covers \Expose\Filter::setRule
* @covers \Expose\Filter::getRule
*/
Expand All @@ -94,7 +96,7 @@ public function testGetSetRule()
/**
* Test that the result is true when a match is found
* for the rule
*
*
* @covers \Expose\Filter::setRule
* @covers \Expose\Filter::execute
*/
Expand All @@ -111,7 +113,7 @@ public function testMatchDataValid()

/**
* Test that the result is false when a match is not found
*
*
* @covers \Expose\Filter::setRule
* @covers \Expose\Filter::execute
*/
Expand All @@ -128,7 +130,7 @@ public function testMAtchDataInvalid()

/**
* Test that the output of the data in an array is correct
*
*
* @covers \Expose\Filter::toArray
*/
public function testOutputAsArray()
Expand All @@ -140,11 +142,11 @@ public function testOutputAsArray()
'tags' => array('csrf', 'xss'),
'impact' => 3
);
$filter = new \Expose\Filter($data);
$filter = new Filter($data);
$data['tags'] = 'csrf, xss';

$this->assertEquals(
$filter->toArray(), $data
);
}
}
}
Loading