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

PHP 8.2 Dynamic Property Deprecation #204

Closed
rneudorf-godaddy opened this issue Jan 31, 2023 · 1 comment · Fixed by #215
Closed

PHP 8.2 Dynamic Property Deprecation #204

rneudorf-godaddy opened this issue Jan 31, 2023 · 1 comment · Fixed by #215
Assignees
Labels
Bug Bug report or pull requests that addresses a bug
Milestone

Comments

@rneudorf-godaddy
Copy link
Contributor

Bug report

In PHP 8.2 dynamic property declaring is deprecated (doc).

When Mocking classes that are unavailable (ex. WP, WP_Post) PHP 8.2 will throw a "Creation of dynamic property...is deprecated" error, causing tests to fail.

Related

Replication steps

Run vendor/bin/phpunit under PHP 8.2.

The following tests fail:

There were 2 errors:

1) WP_Mock\Tests\Unit\WP_Mock\Traits\MockWordPressObjectsTraitTest::testCanMockWordPressPost
Creation of dynamic property Mockery_2__WP_Post::$ID is deprecated

/Users/rneudorf/Projects/godaddy/wp_mock/php/WP_Mock/Traits/MockWordPressObjectsTrait.php:45
/Users/rneudorf/Projects/godaddy/wp_mock/php/WP_Mock/Traits/MockWordPressObjectsTrait.php:43
/Users/rneudorf/Projects/godaddy/wp_mock/tests/Unit/WP_Mock/Traits/MockWordPressObjectsTraitTest.php:50

2) WP_Mock\Tests\Unit\WP_Mock\Traits\MockWordPressObjectsTraitTest::testCanMockWordPressInstance
Creation of dynamic property Mockery_3__WP::$query_vars is deprecated

/Users/rneudorf/Projects/godaddy/wp_mock/php/WP_Mock/Traits/MockWordPressObjectsTrait.php:61
/Users/rneudorf/Projects/godaddy/wp_mock/tests/Unit/WP_Mock/Traits/MockWordPressObjectsTraitTest.php:73

Expected behavior

All tests pass.

@rneudorf-godaddy rneudorf-godaddy added the Bug Bug report or pull requests that addresses a bug label Jan 31, 2023
@rneudorf-godaddy rneudorf-godaddy added this to the Future Release milestone Jan 31, 2023
@rneudorf-godaddy
Copy link
Contributor Author

This should be resolved by mockery/mockery#1210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug report or pull requests that addresses a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants