diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dade39ed28..b6e7f1fe9f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index dbcf6dae7e..669c551511 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -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 diff --git a/tests/console/update/check_test.php b/tests/console/update/check_test.php index 2578eb21cc..a00b49f0d1 100644 --- a/tests/console/update/check_test.php +++ b/tests/console/update/check_test.php @@ -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);