Task #89499

Call static PHPUnit methods via self:: instead of $this->

Added by Alexander Schnitzler 28 days ago. Updated 28 days ago.

Status:
Resolved
Priority:
Should have
Category:
Tests
Target version:
-
Start date:
2019-10-24
Due date:
% Done:

100%

TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Sprint Focus:

Related issues

Related to TYPO3 Core - Bug #89511: new php_cs fixer configuration for static calls of assert-* methods catches one occurence Resolved 2019-10-25

Associated revisions

Revision 362affba (diff)
Added by Alexander Schnitzler 28 days ago

[TASK] Call static PHPUnit methods via self:: instead of $this->

Class \PHPUnit\Framework\TestCase provides many assertion methods
that can be called statically and dynamically in the context of
tests. Sebastian Bergmann states that neither using $this nor
self/static is right or wrong.

There are two reasons to use self/static however. First of all
IDE's like PhpStorm support code inspections that tell you to
not call static methods dynamically and therefore make your
code look like a christmas tree. Secondly, there is a rule
for php-cs-fixer that can take care of the initial change
and which helps sticking to one specific format, unifying
the code style overall.

Releases: master
Resolves: #89499
Change-Id: Ib4a43a94a0df220b052b88b3c3e37e716560e996
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62095
Reviewed-by: Oliver Klee <>
Reviewed-by: Manuel Selbach <>
Reviewed-by: Andreas Fernandez <>
Tested-by: Oliver Klee <>
Tested-by: TYPO3com <>
Tested-by: Manuel Selbach <>
Tested-by: Andreas Fernandez <>

Revision 0b5d8c14 (diff)
Added by Anja Leichsenring 27 days ago

[BUGFIX] Fix missed assert* call in test file

The newly introduced php-cs-fixer rule was not applied to this
test file, so it breaks the nightly cgl integration job.

Resolves: #89511
Related: #89499
Releases: master
Change-Id: I0c60a3f75696c140906d3746494774ff152f48dd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62110
Tested-by: Andreas Fernandez <>
Tested-by: TYPO3com <>
Reviewed-by: Andreas Fernandez <>
Reviewed-by: Oliver Klee <>

History

#1 Updated by Gerrit Code Review 28 days ago

  • Status changed from New to Under Review

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62095

#2 Updated by Gerrit Code Review 28 days ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62095

#3 Updated by Anonymous 28 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#4 Updated by Anja Leichsenring 27 days ago

  • Related to Bug #89511: new php_cs fixer configuration for static calls of assert-* methods catches one occurence added

Also available in: Atom PDF