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

Replace deprecated method of PHPUnit #6346

Closed
vitormattos opened this issue Oct 13, 2021 · 0 comments · Fixed by #6347
Closed

Replace deprecated method of PHPUnit #6346

vitormattos opened this issue Oct 13, 2021 · 0 comments · Fixed by #6347
Assignees
Milestone

Comments

@vitormattos
Copy link
Contributor

vitormattos commented Oct 13, 2021

The PHPUnit method setMethod was replaced by onlyMethod. setMethod was used to create a double of methods that exist and don't exist. Replacing all occurrences of this method, I found a test case creating mock of a method that does not exist.

The method Invitation::parseInvitation was moved to Notification::parseInvitation.

More information: sebastianbergmann/phpunit#3687

Steps to reproduce

  1. replace all occurrences of setMethod by onlyMethod
  2. Run tests
  3. You will receive:
1) OCA\Talk\Tests\php\Activity\Provider\InvitationTest::testParse with data set #0 ('en', true, array(23, 'test1'), array(array('actor-data'), array('call-data')))
PHPUnit\Framework\MockObject\CannotUseOnlyMethodsException: Trying to configure method "parseInvitation" with onlyMethods(), but it does not exist in class "OCA\Talk\Activity\Provider\Invitation". Use addMethods() for methods that do not exist in the class

/var/www/html/apps/spreed/tests/php/Activity/Provider/InvitationTest.php:85
/var/www/html/apps/spreed/tests/php/Activity/Provider/InvitationTest.php:142

2) OCA\Talk\Tests\php\Activity\Provider\InvitationTest::testParse with data set #1 ('de', false, array(42, 'test2'), array(array('actor-data'), array('call-unknown')))
PHPUnit\Framework\MockObject\CannotUseOnlyMethodsException: Trying to configure method "parseInvitation" with onlyMethods(), but it does not exist in class "OCA\Talk\Activity\Provider\Invitation". Use addMethods() for methods that do not exist in the class

/var/www/html/apps/spreed/tests/php/Activity/Provider/InvitationTest.php:85
/var/www/html/apps/spreed/tests/php/Activity/Provider/InvitationTest.php:142

Server configuration

PHP version: 7.4

Nextcloud Version: 23

PHPUnit version: 9.5.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant