Bug #76
Rename test methods, add @test annotation, extend base class
Status: | Closed | Start date: | |||
---|---|---|---|---|---|
Priority: | Should have | Due date: | |||
Assigned To: | - | % Done: | 90% |
||
Category: | - | ||||
Target version: | - | ||||
PHP Version: | Complexity: | ||||
Has patch: | Affected Flow version: |
Description
PHPUnit supports annotations for some time now. Therefore we should remove the "test_" prefix from all test methods and mark the method with a @test annotation instead.
Additionally, test cases should now extend the T3_Testing_BaseTestCase instead of PHPUnit_Framework_TestCase.
Finally, the require_once() for the PHPUnit Base Class is not needed anymore and should be removed.
All this also needs to be documented in the Coding Guidelines.
History
#1 Updated by Robert Lemke over 7 years ago
(In r402) Speed for Unit Tests!
- All unit tests now extend the new T3_Testing_BaseTestCase instead of PHPUnit_Framework_TestCase. Addresses #76.
- CMS: Cleaned up setUp() method - now the componentManager instance is reused. Speed gain: 5833% on my machine! Addresses #76
- Framework: Refactored all unit tests to reuse the componentManager. Full run on my machine before: 4'59", after 0'13". Speed gain: 2300%. Addresses #76
- Framework: Various small bug fixes (including new tests of course) which appeared while refactoring the tests.
#2 Updated by Robert Lemke over 7 years ago
- TYPO3: Made the Page Controller subclass the Request Handling Controller instead of the Abstract Controller.
- Log, PHP6, TypoScript, Widget: Refactored unit tests, addresses #76
#3 Updated by Karsten Dambekalns over 7 years ago
- Added @test annotation, renamed test methods (addresses #76)
- Added some tests
- Added some inline documentation
#4 Updated by Karsten Dambekalns over 7 years ago
The last comment means: this ticket's task is done for the TYPO3CR package
#5 Updated by Tim Eilers over 7 years ago
Should i also create a sniff for the coding guidelines validator which is under development at the moment?
It makes no sense to check all methods for a test tag in a Test Class, since you sometimes want to deactivate some tests for some reasons, but perhaps i could check if a method begins with test_ if it is in a test class.
I also could check if PHPUnit_Framework_TestCase to give out a warning.
What is your opinion?
#6 Updated by Robert Lemke over 7 years ago
@timmy:
If you like you can create a sniff for the following rule:
"Names of methods of classes which are located in files which reside in the Tests/ directory of a package must not start with 'test'".
But that's really low priority - at least from my side.
#7 Updated by Robert Lemke over 7 years ago
- Status changed from New to Closed
- Target version set to 18
- % Done changed from 0 to 90
Seems to be done.
#8 Updated by Robert Lemke about 7 years ago
- Target version deleted (
18)