The visibility of the DrupalTest_TestCase::setUp() and DrupalTest_TestCase::tearDown() methods should be protected, so that they are able to be redeclared in child classes, but can also be called from child classes as parent::setUp() and parent::tearDown().

The declaration of these methods in the DrupalTest_TestCase should be changed to match that used in the DrupalTest_TestSuite. Essentially the DrupalTest_TestCase class setUp and tearDown method declarations should look like this:

class DrupalTest_TestCase extends PHPUnit_Framework_TestCase {
  protected function setUp() {
    parent::setUp();
  }

  protected function tearDown() {
    parent::tearDown();
  }
}
CommentFileSizeAuthor
#1 phpunit-method-visibility.patch802 byteschop

Comments

chop’s picture

Status: Active » Needs review
StatusFileSize
new802 bytes
chop’s picture

Status: Needs review » Fixed

This has been tested and works fine. I've committed the change to HEAD phpunit/lib/DrupalTest/TestCase.php at revision 1.4. I'll see about creating a new non-branch tag that contains this fix soon.

Status: Fixed » Closed (fixed)
Issue tags: -PHPUnit, -test case, -class, -method, -visibility, -setUp, -tearDown

Automatically closed -- issue fixed for 2 weeks with no activity.