Skip to content

Commit c005732

Browse files
authored
Merge pull request #17 from duboism/use_php_8
Convert the test suite to PHPUnitPolyFills and update to PHP 8
2 parents 5d30a9d + c23d5a4 commit c005732

File tree

6 files changed

+14
-41
lines changed

6 files changed

+14
-41
lines changed

.github/workflows/main.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
operating-system: ['ubuntu-latest', 'macos-latest'] #, 'windows-latest']
26-
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
26+
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
2727
steps:
2828
- name: Get source code
2929
uses: actions/checkout@v4

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@
4747
"pear/pear-core-minimal": "^1.10.1"
4848
},
4949
"require-dev": {
50-
"phpunit/phpunit": "^4"
50+
"yoast/phpunit-polyfills": "^2.0"
5151
}
5252
}

package.xml

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ There are two classes to use for templating. HTML_Template_IT is used for basic
6060
<file name="HTML/Template/IT.php" role="php" />
6161
<file name="HTML/Template/ITX.php" role="php" />
6262
<file name="HTML/Template/IT_Error.php" role="php" />
63-
<file name="tests/AllTests.php" role="test" />
6463
<file name="tests/ITTest.php" role="test" />
6564
<file name="tests/ITXTest.php" role="test" />
6665
<file name="tests/templates/addblock.html" role="test" />

tests/AllTests.php

-34
This file was deleted.

tests/ITTest.php

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
<?php
2+
3+
// As we want to run on PHP < 7.1,
4+
// we can't use return type declaration in fixtures.
5+
// Therefore we use PHPUnitPolyFills snakecase fixtures set_up/tear_down
6+
// instead of setUp/tearDown.
7+
// See https://github.com/Yoast/PHPUnit-Polyfills?tab=readme-ov-file#option-1-yoastphpunitpolyfillstestcasestestcase
8+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
9+
210
require_once 'HTML/Template/IT.php';
311

4-
class ITTest extends PHPUnit_Framework_TestCase
12+
class ITTest extends Yoast\PHPUnitPolyfills\TestCases\TestCase
513
{
614
/**
715
* An HTML_Template_IT object
816
* @var object
917
*/
1018
var $tpl;
1119

12-
function setUp()
20+
protected function set_up()
1321
{
1422
$this->tpl = new HTML_Template_IT(dirname(__FILE__) . '/templates');
1523
}
1624

17-
function tearDown()
25+
protected function tear_down()
1826
{
1927
unset($this->tpl);
2028
}

tests/ITXTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static function _numberFormatCallback($float, $decimals)
2323

2424
class ITXTest extends ITTest
2525
{
26-
function setUp()
26+
function set_up()
2727
{
2828
$this->tpl = new HTML_Template_ITX(dirname(__FILE__) . '/templates');
2929
}

0 commit comments

Comments
 (0)