bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.6k forks source link

Fix deprecations for phpunit 10, and maybe update to phpunit10 #6219

Open tenzap opened 1 year ago

tenzap commented 1 year ago

when running the phpunit tests (with phpunit 9.6), these deprecation warnings are reported:

There were 11 warnings:

1) Loader_test::test_library
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

2) Loader_test::test_library_extension
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

3) Loader_test::test_library_config
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

4) Loader_test::test_load_library_in_application_dir
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

5) Loader_test::test_driver
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

6) Loader_test::test_models
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

7) Loader_test::test_model_subdir
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

8) Loader_test::test_initialize
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

9) Driver_test::test_load_driver
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

10) Driver_test::test_load_app_driver
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

php-codeigniter-framework/tests/mocks/ci_testcase.php:353

11) Driver_test::test_load_driver_ext
assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectHasProperty() (PHPUnit 10.1.0+) instead.

When replacement suggested above is done, I face:

Fatal error: Cannot override final method PHPUnit\Framework\TestCase::runBare() in php-codeigniter-framework/tests/mocks/ci_testcase.php on line 351