Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
simpletest.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 May 2013 at 04:03 UTC
Updated:
29 Jul 2014 at 22:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ebrowet commentedHello,
i don't find any GetInfo class in my project. could you explain more.
Comment #2
dawehnerOh right I haven't explained it really. The goal of the issue is to add a new method where we put the information on there.
Comment #3
tim.plunkettComment #4
ebrowet commentedOk i look at this ;).
Comment #5
jhodgdonI think we also need to add setUp(). tearDown() seems to exist on TestBase, but I do not see setUp().
Comment #6
dawehnerDo we need one if there is one on both UnitTestBase and WebTestBase.
Comment #7
jhodgdonI don't know... Are people allowed to extend TestBase or do they need to use UnitTestBase/WebTestBase?
Comment #8
dawehnerNo it's not intended.
Comment #9
tim.plunkettHow about this?
Comment #11
jhodgdonThat looks reasonable to me.
Hmmm... There was a comment in the old documentation saying "Also, this method is empty because you can't have an abstract static method.". If that is true, this won't work?
So... I finally made some time to take a look at TestBase, WebTestBase, and UnitTestBase, to see what's up.
a) At the top of TestBase, it says to use WebTestBaseBase or UnitTestBaseBase, neither of which exist (?!?). Can we fix that in this patch too, or should we file another issue? While we're at it, the namespaces need to start with \ there too. (I checked this because of an assertion above that it would be OK not to have the methods on TestBase if they were on both UnitTestBase and WebTestBase, so I wanted to verify that TestBase actually said "don't extend this class", and it does -- it's just pointing people to the wrong actual classes to use). (So I think it's actually part of this issue to fix these typos, and no kittens will be harmed? :) ).
b) TestBase currently has tearDown(), but not setUp() or getInfo().
c) UnitTestBase currently has setUp() and would inherit tearDown() from TestBase. No getInfo().
d) WebTestBase -- same as (c).
So... This patch would indeed make it so that all of the classes that properly extend one of the two sanctioned base classes would have setUp(), tearDown(), and getInfo(), and if we also fix (a), we'd also ensure that everyone knows that they should extend one of the two actually sanctioned base classes.
As far as the second part of this patch, which replaces doc in UnitTestCase [not UnitTestBase!] with {#inheritdoc}... That won't work. This class doesn't extend TestBase -- it extends \PHPUnit_Framework_TestCase.
The follow-ups to the patch in this issue would be:
- Put an inheritdoc doc block in all setUp(), tearDown(), and getInfo() methods on all test classes extending TestBase
- Fix the online documentation for writing tests to say to use inheritdoc (https://drupal.org/node/325974)
Comment #12
yesct commentedrelated #1869794: Update tests coding standards doc and make consistant with 1354 where appropriate
Comment #13
klausiFixed by #338403: Use {@inheritdoc} on all class methods (including tests).