Skip to content

Commit

Permalink
Upgrade to codeception 5 and upgrade php requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
usox committed Dec 20, 2023
1 parent 1925770 commit e0a247d
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 29 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
php: ['7.4', '8.0', '8.1', '8.2']
continue-on-error: ${{ matrix.php == '8.2' }}
php: ['8.0', '8.1', '8.2', '8.3']
continue-on-error: ${{ matrix.php == '8.3' }}
steps:
- uses: actions/checkout@v2

Expand All @@ -26,16 +26,16 @@ jobs:
run: composer validate

- name: Install dependencies
if: ${{ matrix.php != '8.2' }}
uses: nick-invision/retry@v1
if: ${{ matrix.php != '8.3' }}
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
command: composer update --no-interaction --no-progress

- name: Install Dependencies (ignore platform)
if: ${{ matrix.php == '8.2' }}
uses: nick-invision/retry@v1
if: ${{ matrix.php == '8.3' }}
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
Expand Down
5 changes: 3 additions & 2 deletions codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ paths:
log: tests/_log
data: tests/_data
helpers: tests/_helpers
output: tests/_output
settings:
suite_class: \PHPUnit_Framework_TestSuite
suite_class: \PHPUnit\Framework\TestSuite
colors: true
memory_limit: 1024M
log: true
log: true
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
"type": "library",
"license": "MIT",
"require": {
"php": "^7.4 || ^8",
"php": "~8.0.0||~8.1.0||~8.2.0||~8.3.0",
"ext-sqlite3": "*"
},
"require-dev": {
"codeception/codeception": "^4"
"codeception/codeception": "^5"
},
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"Udger\\": "src/"
Expand Down
12 changes: 8 additions & 4 deletions tests/functional/ParserFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

namespace tests\Udger;

use Codeception\Stub;
use Codeception\Test\Unit;
use FunctionalGuy;
use Udger\Parser;
use Udger\ParserInterface;

class ParserFunctionalTest extends \Codeception\TestCase\Test
class ParserFunctionalTest extends Unit
{
/**
* @var \FunctionalGuy
* @var FunctionalGuy
*/
protected $guy;

Expand All @@ -19,8 +23,8 @@ class ParserFunctionalTest extends \Codeception\TestCase\Test

protected function _before()
{
$this->parser = new \Udger\Parser(
\Codeception\Util\Stub::makeEmpty("Udger\Helper\IP")
$this->parser = new Parser(
Stub::makeEmpty("Udger\Helper\IP")
);
$this->parser->setDataFile(dirname(__DIR__) . "/fixtures/udgercache/udgerdb_v3.dat");
}
Expand Down
12 changes: 8 additions & 4 deletions tests/functional/ParserMultipleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

namespace tests\Udger;

use Codeception\Stub;
use Codeception\Test\Unit;
use Udger\Parser;
use Udger\ParserInterface;
use UnitGuy;

class ParserMultipleTest extends \Codeception\TestCase\Test
class ParserMultipleTest extends Unit
{

/**
* @var \UnitGuy
* @var UnitGuy
*/
protected $guy;

Expand All @@ -20,8 +24,8 @@ class ParserMultipleTest extends \Codeception\TestCase\Test

protected function _before()
{
$this->parser = new \Udger\Parser(
\Codeception\Util\Stub::makeEmpty("Udger\Helper\IP")
$this->parser = new Parser(
Stub::makeEmpty("Udger\Helper\IP")
);
$this->parser->setDataFile(dirname(__DIR__) . "/fixtures/udgercache/udgerdb_v3.dat");
}
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/Helper/IPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

namespace tests\Udger\Helper;

use Codeception\Test\Unit;
use Udger\Helper\IP;
use UnitGuy;

/**
*
* @author tiborb
*/
class ParserFactoryTest extends \Codeception\TestCase\Test
class ParserFactoryTest extends Unit
{

/**
* @var \UnitGuy
* @var UnitGuy
*/
protected $guy;

Expand Down
6 changes: 4 additions & 2 deletions tests/unit/ParserFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace tests\Udger;

use Codeception\Test\Unit;
use Udger\ParserFactory;
use UnitGuy;

class ParserFactoryTest extends \Codeception\TestCase\Test
class ParserFactoryTest extends Unit
{

/**
* @var \UnitGuy
* @var UnitGuy
*/
protected $guy;

Expand Down
17 changes: 11 additions & 6 deletions tests/unit/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

namespace tests\Udger;

class ParserTest extends \Codeception\TestCase\Test
use Codeception\Stub;
use Codeception\Test\Unit;
use Exception;
use Udger\Parser;
use UnitGuy;

class ParserTest extends Unit
{

/**
* @var \UnitGuy
* @var UnitGuy
*/
protected $guy;

Expand All @@ -18,8 +24,8 @@ class ParserTest extends \Codeception\TestCase\Test

protected function _before()
{
$this->parser = new \Udger\Parser(
\Codeception\Util\Stub::makeEmpty("Udger\Helper\IP")
$this->parser = new Parser(
Stub::makeEmpty("Udger\Helper\IP")
);
#$this->parser->setAccessKey("udger-php-unit");
$this->parser->setDataFile("/dev/null");
Expand All @@ -32,7 +38,7 @@ protected function _after()
// tests
public function testSetDataFile()
{
$this->expectException(\Exception::class);
$this->expectException(Exception::class);
$this->assertTrue($this->parser->setDataFile("/this/is/a/missing/path"));
}

Expand All @@ -48,7 +54,6 @@ public function testSetIP()

public function testParse()
{
#$this->setExpectedException("Exception");
$this->parser->parse();
}
}

0 comments on commit e0a247d

Please sign in to comment.