1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-10-12 15:34:31 +02:00

Merge pull request #6878 from marc1706/ticket/17555

[ticket/17555] Only run unit tests on windows runners
This commit is contained in:
Marc Alexander
2025-10-06 18:13:29 +02:00
committed by GitHub
3 changed files with 40 additions and 42 deletions

View File

@@ -480,42 +480,18 @@ jobs:
include:
- php: '7.4'
db: "postgres"
type: 'unit'
- php: '8.0'
db: "postgres"
type: 'unit'
- php: '8.1'
db: "postgres"
type: 'unit'
- php: '8.2'
db: "postgres"
type: 'unit'
- php: '8.3'
db: "postgres"
type: 'unit'
- php: '8.4'
db: "postgres"
type: 'unit'
- php: '7.4'
db: "postgres"
type: 'functional'
- php: '8.0'
db: "postgres"
type: 'functional'
- php: '8.1'
db: "postgres"
type: 'functional'
- php: '8.2'
db: "postgres"
type: 'functional'
- php: '8.3'
db: "postgres"
type: 'functional'
- php: '8.4'
db: "postgres"
type: 'functional'
name: Windows - PHP ${{ matrix.php }} - ${{ matrix.db }} - ${{ matrix.type }}
name: Windows - PHP ${{ matrix.php }} - ${{ matrix.db }}
steps:
- name: Prepare git for Windows
@@ -643,16 +619,8 @@ jobs:
Set-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender
- name: Run unit tests
if: ${{ matrix.type == 'unit' }}
run: |
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --exclude-group functional
- name: Run unit tests
if: ${{ matrix.type == 'functional' }}
timeout-minutes: 45
env:
PHPBB_FUNCTIONAL_TIMEOUT: 30
SYMFONY_DEPRECATIONS_HELPER: disabled
PHPBB_TEST_REDIS_HOST: ''
PHPBB_TEST_MEMCACHED_HOST: ''
run: |
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --group functional
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 3
command: phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --verbose --stop-on-error --exclude-group functional

View File

@@ -57,7 +57,11 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
new \phpbb\mimetype\content_guesser,
);
$guesser = new \phpbb\mimetype\guesser($guessers);
$imagesize = new \FastImageSize\FastImageSize();
$imagesize = $this->getMockBuilder('\FastImageSize\FastImageSize')
->setMethods(['getImageSize'])
->getMock();
$imagesize->method('getImageSize')
->willReturn(['width' => 80, 'height' => 80, 'mime' => 'image/jpeg']);
$dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_dispatcher = $dispatcher;
@@ -405,9 +409,9 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
{
return array(
array('127.0.0.1:91?foo.jpg', 80, 80, array('AVATAR_URL_INVALID')),
array(gethostbyname('secure.gravatar.com') . '/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')),
array('127.0.0.1/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')),
array('secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80),
array(gethostbyname('secure.gravatar.com') . ':120/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')),
array('127.0.0.1:120/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')),
array('secure.gravatar.com:80/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')),
array('secure.gravatar.com:80?55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')),
array('secure.gravatar.com?55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')), // should be a 404

View File

@@ -94,7 +94,33 @@ class phpbb_console_command_check_test extends phpbb_test_case
->getMock();
$config = new \phpbb\config\config(array('version' => $current_version));
$this->version_helper = new \phpbb\version_helper($cache, $config, new \phpbb\file_downloader());
$this->version_helper = $this->getMockBuilder('\phpbb\version_helper')
->setConstructorArgs([$cache, $config, new \phpbb\file_downloader()])
->setMethods(['get_latest_version', 'get_suggested_updates'])
->getMock();
$this->version_helper->method('get_suggested_updates')
->willReturnCallback(function($force_update = false, $force_cache = false) use ($config)
{
if ($config['version'] === '100000')
{
return [];
}
else if ($config['version'] === '0')
{
return [
[
'current' => '100000',
'announcement' => 'https://www.phpbb.com/downloads/',
'eol' => null,
'security' => false,
],
];
}
else
{
throw new \phpbb\exception\runtime_exception('VERSIONCHECK_FAIL');
}
});
$container = new phpbb_mock_container_builder;
$container->set('version_helper', $this->version_helper);