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

Method "$this->getMock()" is deprecated #6925

Closed
wants to merge 1 commit into from
Closed

Method "$this->getMock()" is deprecated #6925

wants to merge 1 commit into from

Conversation

JohnnyEvo
Copy link

No description provided.

@javiereguiluz javiereguiluz changed the title Method "$this->getMock()" is depreciated Method "$this->getMock()" is deprecated Aug 29, 2016
@javiereguiluz
Copy link
Member

👍 getMock() is deprecated since PHPUnit 5.4.0. However, I wonder if we should use createMock() or getMockBuilder():

The PHPUnit\Framework\TestCase::getMock() method has been deprecated. Please use PHPUnit\Framework\TestCase::createMock() or PHPUnit\Framework\TestCase::getMockBuilder() instead.

Source: https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.4.0#changes

@ogizanagi
Copy link
Contributor

👍 for using createMock()

@ousmaneNdiaye
Copy link
Contributor

👍

@JohnnyEvo
Copy link
Author

@ogizanagi Why use createMock() instead of getMockBuilder() ? I didn't know createMock() but createMock() doesn't invoke the constructor it seems to me, so it's possible that there are bad surprises.

@ogizanagi
Copy link
Contributor

ogizanagi commented Aug 30, 2016

@JohnnyEvo : Right, but ObjectManager is an interface anyway. So using ->createMock() won't cause any issue. Also unless you do partial mocking on concrete classes, most of the time the original constructor call is not necessary.

@JohnnyEvo
Copy link
Author

Ok, thank you for your explanation 👍

weaverryan added a commit that referenced this pull request Sep 18, 2016
This PR was submitted for the 3.1 branch but it was merged into the 2.8 branch instead (closes #6925).

Discussion
----------

Method "$this->getMock()" is deprecated

Commits
-------

e151754 Method "$this->getMock()" is depreciated
weaverryan added a commit that referenced this pull request Sep 18, 2016
* 2.7:
  [#6925] Removing more instances of the deprecated getMock()
  Minor language tweaks
  removing cookbook entries
  updating links
  Moving files into the new structure
  [#6649] Changing a note to a caution - this *is* a gotcha
  fix typo
  Typo in the class name.
  Fixed indentation issues in alias_private article
  [Serializer] Document the encoders
@weaverryan
Copy link
Member

Thanks guys! I've also updated a number of other getMock() usages at sha: c52839a

Cheers!

weaverryan added a commit that referenced this pull request Sep 18, 2016
* 2.8: (32 commits)
  [#6925] Removing more instances of the deprecated getMock()
  Method "$this->getMock()" is depreciated
  Minor language tweaks
  removing cookbook entries
  updating links
  Moving files into the new structure
  [#6649] Changing a note to a caution - this *is* a gotcha
  fix typo
  Typo in the class name.
  Update tags.rst
  Fixed indentation issues in alias_private article
  Fix the error in code example
  [Controller Description] Remove backticks
  [Controller] Fix nested inline markup
  [Controller Description] Fix typos and class link
  Fix var_dumper advanced usage link
  [#6908] Add deprecations on some other places as well
  Add deprecation warnings to relevant profiler options
  Update access_control.rst
  DumpFile() third argument is deprecated and doesn't exists anymore in 3.x
  ...
weaverryan added a commit that referenced this pull request Sep 18, 2016
* 3.0:
  [#6925] Removing more instances of the deprecated getMock()
  Method "$this->getMock()" is depreciated
  Minor language tweaks
  removing cookbook entries
  updating links
  Moving files into the new structure
  [#6649] Changing a note to a caution - this *is* a gotcha
  fix typo
  Typo in the class name.
  Update tags.rst
  Fixed indentation issues in alias_private article
  [Serializer] Document the encoders
@weaverryan weaverryan closed this Sep 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants