Skip to content

Commit

Permalink
! Its php8+ now, update deps as the testbase does not have to support…
Browse files Browse the repository at this point in the history
… 7.x
  • Loading branch information
Spuds committed Jan 25, 2024
1 parent 7488c31 commit 4e7cb02
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/phpunit-webtest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="bootstrapInstall.php">
<testsuites>
<testsuite name="Web Tests">
<testsuite name="Install Tests">
<directory suffix="Web.php">../tests</directory>
</testsuite>
</testsuites>
Expand Down
6 changes: 4 additions & 2 deletions .github/setup-elkarte.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ fi
# Phpunit and support
# composer config --file=composer2.json && composer install --no-interaction --quiet
composer install --no-interaction --quiet
if [[ "$PHP_VERSION" =~ ^8 ]]

# phpunit-selenium is compatible with phpunit 9.3.x, past that it runs all methods not just test methods
if [[ "$WEBSERVER" != "none" ]]
then
composer remove phpunit/phpunit phpunit/phpunit-selenium --dev
composer require phpunit/phpunit:^9.0 --dev --update-with-all-dependencies --ignore-platform-reqs
composer require phpunit/phpunit:~9.3 --dev --update-with-all-dependencies --ignore-platform-reqs
fi
3 changes: 1 addition & 2 deletions .github/setup-selenium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ else
echo "Selenium Success"

# Copy phpunit_coverage.php into the webserver's document root directory.
# cp ./vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php .
cp ./tests/phpunit_coverage.php .
cp ./vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php .

# Run the phpunit selenium tests
vendor/bin/phpunit --verbose --debug --configuration .github/phpunit-webtest.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
include:
- db: "mysql:5.7"
php: '8.2'
php: '8.1'

name: WebTest (PHP ${{ matrix.php }} - DB ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }})

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"replace": {
},
"require": {
"php": ">=7.2.0",
"php": ">=8.0.0",
"ext-json": "*",
"ext-gd": "*",
"ext-curl": "*",
Expand All @@ -50,8 +50,8 @@
"ext-imagick": "*"
},
"require-dev": {
"phpunit/phpunit-selenium": "8.*",
"phpunit/phpunit": "~8",
"phpunit/phpunit-selenium": "9.0.1",
"phpunit/phpunit": "9.6.*",
"myclabs/deep-copy": "1.11.0"
},
"autoload": {
Expand Down
43 changes: 23 additions & 20 deletions tests/ExitHandler.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
<?php

namespace PHPUnit\Extensions\SeleniumCommon;

/**
* If Ececution was stopped by calling exit();
* php does not append append.php, so no code coverage date is collected
* We have to add shutdown handler to append this file manualy.
* @author Arbuzov <info@whitediver.com>
*
*/
class PHPUnit_Extensions_SeleniumCommon_ExitHandler
class ExitHandler
{
/**
* Register handler.
* If project have own shutdown hanldler user have to add function to handler
*
*/
public static function init()
{
register_shutdown_function( array( 'PHPUnit_Extensions_SeleniumCommon_ExitHandler', 'handle' ) );
}
/**
* Register handler.
* If project have own shutdown hanldler user have to add function to handler
*
*/
public static function init()
{
register_shutdown_function(array(ExitHandler::class, 'handle'));
}

/**
* Manual include apendable files
*/
public static function handle()
{
$execFile = ini_get('auto_append_file');
if ($execFile!=='') {
include_once ($execFile);
}
}
/**
* Manual include apendable files
*/
public static function handle()
{
$execFile = ini_get('auto_append_file');
if ($execFile!=='') {
include_once ($execFile);
}
}
}
95 changes: 0 additions & 95 deletions tests/phpunit_coverage.php

This file was deleted.

5 changes: 4 additions & 1 deletion tests/prepend.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@
* @since File available since Release 1.0.0
*/

use PHPUnit\Extensions\SeleniumCommon\ExitHandler;

// By default the code coverage files are written to the same directory
// that contains the covered sourcecode files. Use this setting to change
// the default behaviour and set a specific directory to write the files to.
// If you change the default setting, please make sure to also configure
// the same directory in phpunit_coverage.php. Also note that the webserver
// needs write access to the directory.

if (!isset($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = FALSE;
}
Expand All @@ -61,4 +64,4 @@
}

include ('ExitHandler.php');
PHPUnit_Extensions_SeleniumCommon_ExitHandler::init();
ExitHandler::init();
3 changes: 2 additions & 1 deletion tests/sources/controllers/ElkArteWebSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
*/
abstract class ElkArteWebSupport extends Selenium2TestCase
{
protected $coverageScriptUrl = 'http://127.0.0.1/phpunit_coverage.php';
//protected $coverageScriptUrl = 'http://127.0.0.1/phpunit_coverage.php';
protected $coverageScriptUrl = '';
protected $backupGlobalsExcludeList = ['user_info'];
protected $width = 2560;
protected $height = 1440;
Expand Down

0 comments on commit 4e7cb02

Please sign in to comment.