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

Convert the test suite to PHPUnitPolyFills and update to PHP 8 #17

Merged
merged 6 commits into from
Nov 24, 2024
Merged
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
49 changes: 49 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Main

on:
workflow_dispatch:
push:
branches:
- main
- master
- release/**
pull_request:
branches:
- main
- master
- release/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-latest', 'macos-latest'] #, 'windows-latest']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- name: Get source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
ini-values: post_max_size=256M, max_execution_time=180
- run: sudo pear list
- run: sudo pear channel-update pear.php.net
- run: sudo pear upgrade --force pear/pear
- run: sudo pear list
- run: sudo pear install --force package.xml
- run: sudo pear list
- run: sudo pear package
- run: sudo pear package-validate
- run: sudo pear install --force *.tgz
- run: sudo pear list
- run: composer install
- run: ./vendor/bin/phpunit tests
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
"pear/pear-core-minimal": "^1.10.1"
},
"require-dev": {
"phpunit/phpunit": "^4"
"yoast/phpunit-polyfills": "^2.0"
}
}
1 change: 0 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ There are two classes to use for templating. HTML_Template_IT is used for basic
<file name="HTML/Template/IT.php" role="php" />
<file name="HTML/Template/ITX.php" role="php" />
<file name="HTML/Template/IT_Error.php" role="php" />
<file name="tests/AllTests.php" role="test" />
<file name="tests/ITTest.php" role="test" />
<file name="tests/ITXTest.php" role="test" />
<file name="tests/templates/addblock.html" role="test" />
Expand Down
29 changes: 0 additions & 29 deletions phpunit.xml.dist

This file was deleted.

34 changes: 0 additions & 34 deletions tests/AllTests.php

This file was deleted.

14 changes: 11 additions & 3 deletions tests/ITTest.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
<?php

// As we want to run on PHP < 7.1,
// we can't use return type declaration in fixtures.
// Therefore we use PHPUnitPolyFills snakecase fixtures set_up/tear_down
// instead of setUp/tearDown.
// See https://github.com/Yoast/PHPUnit-Polyfills?tab=readme-ov-file#option-1-yoastphpunitpolyfillstestcasestestcase
use Yoast\PHPUnitPolyfills\TestCases\TestCase;

require_once 'HTML/Template/IT.php';

class ITTest extends PHPUnit_Framework_TestCase
class ITTest extends Yoast\PHPUnitPolyfills\TestCases\TestCase
{
/**
* An HTML_Template_IT object
* @var object
*/
var $tpl;

function setUp()
protected function set_up()
{
$this->tpl = new HTML_Template_IT(dirname(__FILE__) . '/templates');
}

function tearDown()
protected function tear_down()
{
unset($this->tpl);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ITXTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static function _numberFormatCallback($float, $decimals)

class ITXTest extends ITTest
{
function setUp()
function set_up()
{
$this->tpl = new HTML_Template_ITX(dirname(__FILE__) . '/templates');
}
Expand Down