mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Change visibility of setUp
and tearDown
to original protected
This commit is contained in:
parent
9ee4abd2c3
commit
d47cd9e172
@ -45,14 +45,14 @@ final class DatabaseTestCase extends CIUnitTestCase
|
||||
*/
|
||||
protected $namespace = 'Tests\Support';
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// Extra code to run before each test
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -17,7 +17,7 @@ final class SessionTestCase extends CIUnitTestCase
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -7,7 +7,7 @@ use Tests\Support\Models\ExampleModel;
|
||||
*/
|
||||
final class ExampleDatabaseTest extends \Tests\Support\DatabaseTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
final class ExampleSessionTest extends \Tests\Support\SessionTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
final class ExampleTest extends \CodeIgniter\Test\CIUnitTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -45,14 +45,14 @@ final class DatabaseTestCase extends CIUnitTestCase
|
||||
*/
|
||||
protected $namespace = 'Tests\Support';
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// Extra code to run before each test
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -17,7 +17,7 @@ final class SessionTestCase extends CIUnitTestCase
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -7,7 +7,7 @@ use Tests\Support\Models\ExampleModel;
|
||||
*/
|
||||
final class ExampleDatabaseTest extends \Tests\Support\DatabaseTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
final class ExampleSessionTest extends \Tests\Support\SessionTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use Config\Services;
|
||||
*/
|
||||
final class HealthTest extends \CodeIgniter\Test\CIUnitTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ final class CLITest extends CIUnitTestCase
|
||||
$this->stream_filter = stream_filter_append(STDOUT, 'CITestStreamFilter');
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
stream_filter_remove($this->stream_filter);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ final class CommandRunnerTest extends CIUnitTestCase
|
||||
$this->streamFilter = stream_filter_append(STDERR, 'CITestStreamFilter');
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
stream_filter_remove($this->streamFilter);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ final class ConsoleTest extends CIUnitTestCase
|
||||
$this->app = new MockCodeIgniter(new MockCLIConfig());
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
stream_filter_remove($this->stream_filter);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ final class CacheFactoryTest extends CIUnitTestCase
|
||||
$this->config->storePath .= self::$directory;
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (is_dir($this->config->storePath)) {
|
||||
chmod($this->config->storePath, 0777);
|
||||
|
@ -49,7 +49,7 @@ final class FileHandlerTest extends CIUnitTestCase
|
||||
$this->fileHandler->initialize();
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -40,7 +40,7 @@ final class MemcachedHandlerTest extends CIUnitTestCase
|
||||
$this->memcachedHandler->initialize();
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
foreach (self::getKeyArray() as $key) {
|
||||
$this->memcachedHandler->delete($key);
|
||||
|
@ -39,7 +39,7 @@ final class PredisHandlerTest extends CIUnitTestCase
|
||||
$this->PredisHandler->initialize();
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
foreach (self::getKeyArray() as $key) {
|
||||
$this->PredisHandler->delete($key);
|
||||
|
@ -39,7 +39,7 @@ final class RedisHandlerTest extends CIUnitTestCase
|
||||
$this->redisHandler->initialize();
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
foreach (self::getKeyArray() as $key) {
|
||||
$this->redisHandler->delete($key);
|
||||
|
@ -37,7 +37,7 @@ final class CodeIgniterTest extends CIUnitTestCase
|
||||
$this->codeigniter = new MockCodeIgniter($config);
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -26,7 +26,7 @@ final class ClearCacheTest extends CIUnitTestCase
|
||||
Services::injectMock('cache', CacheFactory::getHandler(config('Cache')));
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
stream_filter_remove($this->streamFilter);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ final class InfoCacheTest extends CIUnitTestCase
|
||||
Services::injectMock('cache', CacheFactory::getHandler(config('Cache')));
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
stream_filter_remove($this->streamFilter);
|
||||
|
||||
|
@ -22,7 +22,7 @@ final class SessionsCommandsTest extends CIUnitTestCase
|
||||
$this->streamFilter = stream_filter_append(STDERR, 'CITestStreamFilter');
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
stream_filter_remove($this->streamFilter);
|
||||
|
||||
|
@ -52,7 +52,7 @@ final class ServicesTest extends CIUnitTestCase
|
||||
$this->config = new App();
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$_SERVER = $this->original;
|
||||
Services::reset();
|
||||
|
@ -45,7 +45,7 @@ final class DatabaseTestCaseMigrationOnce1Test extends CIUnitTestCase
|
||||
'Tests\Support\MigrationTestMigrations',
|
||||
];
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
Services::autoloader()->addNamespace('Tests\Support\MigrationTestMigrations', SUPPORTPATH . 'MigrationTestMigrations');
|
||||
|
||||
|
@ -44,7 +44,7 @@ final class DatabaseTestCaseMigrationOnce2Test extends CIUnitTestCase
|
||||
'Tests\Support\MigrationTestMigrations',
|
||||
];
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
Services::autoloader()->addNamespace('Tests\Support\MigrationTestMigrations', SUPPORTPATH . 'MigrationTestMigrations');
|
||||
|
||||
|
@ -49,7 +49,7 @@ final class DatabaseTestCaseTest extends CIUnitTestCase
|
||||
'Tests\Support\MigrationTestMigrations',
|
||||
];
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
if (! self::$loaded) {
|
||||
Services::autoloader()->addNamespace('Tests\Support\MigrationTestMigrations', SUPPORTPATH . 'MigrationTestMigrations');
|
||||
|
@ -30,7 +30,7 @@ final class DEBugTest extends CIUnitTestCase
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->setPrivateProperty($this->db, 'DBDebug', true);
|
||||
parent::tearDown();
|
||||
|
@ -22,7 +22,7 @@ final class GetNumRowsTest extends CIUnitTestCase
|
||||
*
|
||||
* @see \CodeIgniter\Test\CIDatabaseTestCase::setUp()
|
||||
*/
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
@ -33,7 +33,7 @@ final class GetNumRowsTest extends CIUnitTestCase
|
||||
*
|
||||
* @see \CodeIgniter\Test\CIDatabaseTestCase::tearDown()
|
||||
*/
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ final class PretendTest extends CIUnitTestCase
|
||||
{
|
||||
use DatabaseTestTrait;
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
// We share `$this->db` in testing, so we need to restore the state.
|
||||
$this->db->pretend(false);
|
||||
|
@ -40,7 +40,7 @@ final class AlterTableTest extends CIUnitTestCase
|
||||
*/
|
||||
protected $forge;
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -29,7 +29,7 @@ final class MigrationRunnerTest extends CIUnitTestCase
|
||||
protected $start;
|
||||
protected $config;
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -13,7 +13,7 @@ final class MigrationTest extends CIUnitTestCase
|
||||
{
|
||||
use DatabaseTestTrait;
|
||||
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ final class FileWithVfsTest extends CIUnitTestCase
|
||||
$this->file = new File($this->start . 'able/apple.php');
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -13,7 +13,7 @@ use DateTimeZone;
|
||||
*/
|
||||
final class DownloadResponseTest extends CIUnitTestCase
|
||||
{
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (isset($_SERVER['HTTP_USER_AGENT'])) {
|
||||
unset($_SERVER['HTTP_USER_AGENT']);
|
||||
|
@ -28,7 +28,7 @@ final class FileMovingTest extends CIUnitTestCase
|
||||
$_FILES = [];
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
$this->root = null;
|
||||
|
@ -25,7 +25,7 @@ final class MessageTest extends CIUnitTestCase
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->message = null;
|
||||
unset($this->message);
|
||||
|
@ -33,7 +33,7 @@ final class NegotiateTest extends CIUnitTestCase
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->request = $this->negotiate = null;
|
||||
unset($this->request, $this->negotiate);
|
||||
|
@ -25,7 +25,7 @@ final class ResponseTest extends CIUnitTestCase
|
||||
$this->server = $_SERVER;
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$_SERVER = $this->server;
|
||||
Factories::reset('config');
|
||||
|
@ -22,7 +22,7 @@ final class URITest extends CIUnitTestCase
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
Factories::reset('config');
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ final class CurrentUrlTest extends CIUnitTestCase
|
||||
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -41,7 +41,7 @@ final class MiscUrlTest extends CIUnitTestCase
|
||||
Factories::injectMock('config', 'App', $this->config);
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -42,7 +42,7 @@ final class SiteUrlTest extends CIUnitTestCase
|
||||
Factories::injectMock('config', 'App', $this->config);
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -60,7 +60,7 @@ final class ResourceControllerTest extends CIUnitTestCase
|
||||
$this->codeigniter = new MockCodeIgniter($config);
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -54,7 +54,7 @@ final class ResourcePresenterTest extends CIUnitTestCase
|
||||
$this->codeigniter = new MockCodeIgniter($config);
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -14,7 +14,7 @@ use Config\Modules;
|
||||
*/
|
||||
final class RouteCollectionTest extends CIUnitTestCase
|
||||
{
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ final class RouterTest extends CIUnitTestCase
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ final class BootstrapFCPATHTest extends CIUnitTestCase
|
||||
$this->writeFiles();
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
$this->deleteFiles();
|
||||
|
@ -12,7 +12,7 @@ use stdClass;
|
||||
*/
|
||||
final class TableTest extends CIUnitTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->table = new MockTable();
|
||||
}
|
||||
|
@ -157,9 +157,10 @@ final class CodeIgniter4 extends AbstractRuleset
|
||||
'target' => 'newest',
|
||||
'use_class_const' => true,
|
||||
],
|
||||
'phpdoc_align' => true,
|
||||
'phpdoc_indent' => true,
|
||||
'phpdoc_inline_tag_normalizer' => [
|
||||
'php_unit_set_up_tear_down_visibility' => true,
|
||||
'phpdoc_align' => true,
|
||||
'phpdoc_indent' => true,
|
||||
'phpdoc_inline_tag_normalizer' => [
|
||||
'tags' => [
|
||||
'example',
|
||||
'id',
|
||||
|
Loading…
x
Reference in New Issue
Block a user