Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Make methods setUp and tearDown protected #4783

Closed
wants to merge 1 commit into from

5 participants

@gag237

In phpunit these methods is protected.

@coveralls

Coverage Status

Coverage remained the same when pulling 313ff1b on gag237:setUp_is_protected into 260205f on zendframework:develop.

@coveralls

Coverage Status

Coverage remained the same when pulling 313ff1b on gag237:setUp_is_protected into 260205f on zendframework:develop.

@coveralls

Coverage Status

Coverage remained the same when pulling 313ff1b on gag237:setUp_is_protected into 260205f on zendframework:develop.

@weierophinney

PHP allows extending classes to redefine visibility of methods as long as the new visibility is more permissive; I see no reason to change this, particularly as it's common practice to define these methods as public when writing test cases.

@gag237

Methods are never called from outside the object, in other words there is no need to be public.

The second argument: from a protected to public can do always, and not the reverse; so get the error: "Access level to setUp () must be public"

@DASPRiD
Collaborator

Does this cover all occurences?

@gag237

TestCase these are intended for use outside zf2.
The other TestCase Used for internal testing. Therefore, there is not changed. If you want to change and there - let me know.

@weierophinney

Cherry-picked into master and merged to develop.

@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-test
@weierophinney weierophinney Merge branch 'hotfix/4783' cf6ac15
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-test
@weierophinney weierophinney Merge branch 'hotfix/4783' into develop c151903
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 4, 2013
  1. @gag237
This page is out of date. Refresh to see the latest.
View
4 library/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php
@@ -53,7 +53,7 @@
/**
* Reset the application for isolation
*/
- public function setUp()
+ protected function setUp()
{
$this->usedConsoleBackup = Console::isConsole();
$this->reset();
@@ -62,7 +62,7 @@ public function setUp()
/**
* Restore params
*/
- public function tearDown()
+ protected function tearDown()
{
Console::overrideIsConsole($this->usedConsoleBackup);
}
View
2  tests/ZendTest/Test/PHPUnit/Controller/AbstractConsoleControllerTestCaseTest.php
@@ -19,7 +19,7 @@
*/
class AbstractConsoleControllerTestCaseTest extends AbstractConsoleControllerTestCase
{
- public function setUp()
+ protected function setUp()
{
$this->setApplicationConfig(
include __DIR__ . '/../../_files/application.config.php'
View
4 tests/ZendTest/Test/PHPUnit/Controller/AbstractControllerTestCaseTest.php
@@ -41,7 +41,7 @@ public static function rmdir($dir)
return rmdir($dir);
}
- public function setUp()
+ protected function setUp()
{
$this->tearDownCacheDir();
Console::overrideIsConsole(null);
@@ -51,7 +51,7 @@ public function setUp()
parent::setUp();
}
- public function tearDown()
+ protected function tearDown()
{
$this->tearDownCacheDir();
parent::tearDown();
Something went wrong with that request. Please try again.