Skip to content

Other PHPUnit-related fixers #4871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions admin/module/tests/_support/DatabaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion admin/module/tests/_support/SessionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class SessionTestCase extends CIUnitTestCase
*/
protected $session;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion admin/module/tests/database/ExampleDatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
final class ExampleDatabaseTest extends \Tests\Support\DatabaseTestCase
{
public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion admin/module/tests/session/ExampleSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
final class ExampleSessionTest extends \Tests\Support\SessionTestCase
{
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
}
Expand Down
2 changes: 1 addition & 1 deletion admin/module/tests/unit/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
final class ExampleTest extends \CodeIgniter\Test\CIUnitTestCase
{
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
}
Expand Down
4 changes: 2 additions & 2 deletions admin/starter/tests/_support/DatabaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion admin/starter/tests/_support/SessionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class SessionTestCase extends CIUnitTestCase
*/
protected $session;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion admin/starter/tests/database/ExampleDatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
final class ExampleDatabaseTest extends \Tests\Support\DatabaseTestCase
{
public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion admin/starter/tests/session/ExampleSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
final class ExampleSessionTest extends \Tests\Support\SessionTestCase
{
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
}
Expand Down
2 changes: 1 addition & 1 deletion admin/starter/tests/unit/HealthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
final class HealthTest extends \CodeIgniter\Test\CIUnitTestCase
{
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CLI/CLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function setUp(): void
$this->stream_filter = stream_filter_append(STDOUT, 'CITestStreamFilter');
}

public function tearDown(): void
protected function tearDown(): void
{
stream_filter_remove($this->stream_filter);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CLI/CommandRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function setUp(): void
$this->streamFilter = stream_filter_append(STDERR, 'CITestStreamFilter');
}

public function tearDown(): void
protected function tearDown(): void
{
stream_filter_remove($this->streamFilter);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CLI/ConsoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function setUp(): void
$this->app = new MockCodeIgniter(new MockCLIConfig());
}

public function tearDown(): void
protected function tearDown(): void
{
stream_filter_remove($this->stream_filter);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Cache/CacheFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
$this->config->storePath .= self::$directory;
}

public function tearDown(): void
protected function tearDown(): void
{
if (is_dir($this->config->storePath)) {
chmod($this->config->storePath, 0777);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Cache/Handlers/FileHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function setUp(): void
$this->fileHandler->initialize();
}

public function tearDown(): void
protected function tearDown(): void
{
parent::tearDown();

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Cache/Handlers/MemcachedHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function setUp(): void
$this->memcachedHandler->initialize();
}

public function tearDown(): void
protected function tearDown(): void
{
foreach (self::getKeyArray() as $key) {
$this->memcachedHandler->delete($key);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Cache/Handlers/PredisHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function setUp(): void
$this->PredisHandler->initialize();
}

public function tearDown(): void
protected function tearDown(): void
{
foreach (self::getKeyArray() as $key) {
$this->PredisHandler->delete($key);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Cache/Handlers/RedisHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function setUp(): void
$this->redisHandler->initialize();
}

public function tearDown(): void
protected function tearDown(): void
{
foreach (self::getKeyArray() as $key) {
$this->redisHandler->delete($key);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function setUp(): void
$this->codeigniter = new MockCodeIgniter($config);
}

public function tearDown(): void
protected function tearDown(): void
{
parent::tearDown();

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Commands/ClearCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
Services::injectMock('cache', CacheFactory::getHandler(config('Cache')));
}

public function tearDown(): void
protected function tearDown(): void
{
stream_filter_remove($this->streamFilter);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Commands/InfoCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
Services::injectMock('cache', CacheFactory::getHandler(config('Cache')));
}

public function tearDown(): void
protected function tearDown(): void
{
stream_filter_remove($this->streamFilter);

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Commands/SessionsCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function setUp(): void
$this->streamFilter = stream_filter_append(STDERR, 'CITestStreamFilter');
}

public function tearDown(): void
protected function tearDown(): void
{
stream_filter_remove($this->streamFilter);

Expand Down
2 changes: 1 addition & 1 deletion tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function testRedirectReturnsRedirectResponse()
\CodeIgniter\Services::injectMock('routes', $routes);

$routes->add('home/base', 'Controller::index', ['as' => 'base']);
$response->method('redirect')->will($this->returnArgument(0));
$response->method('redirect')->willReturnArgument(0);

$this->assertInstanceOf(RedirectResponse::class, redirect('base'));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Config/ServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function setUp(): void
$this->config = new App();
}

public function tearDown(): void
protected function tearDown(): void
{
$_SERVER = $this->original;
Services::reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/DatabaseTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Live/DEBugTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testDBDebugFalse()
$this->assertFalse($result);
}

public function tearDown(): void
protected function tearDown(): void
{
$this->setPrivateProperty($this->db, 'DBDebug', true);
parent::tearDown();
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Database/Live/GetNumRowsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class GetNumRowsTest extends CIUnitTestCase
*
* @see \CodeIgniter\Test\CIDatabaseTestCase::setUp()
*/
public function setUp(): void
protected function setUp(): void
{
parent::setUp();
}
Expand All @@ -33,7 +33,7 @@ public function setUp(): void
*
* @see \CodeIgniter\Test\CIDatabaseTestCase::tearDown()
*/
public function tearDown(): void
protected function tearDown(): void
{
parent::tearDown();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Live/PretendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Live/SQLite/AlterTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class AlterTableTest extends CIUnitTestCase
*/
protected $forge;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Migrations/MigrationRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class MigrationRunnerTest extends CIUnitTestCase
protected $start;
protected $config;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Migrations/MigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class MigrationTest extends CIUnitTestCase
{
use DatabaseTestTrait;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Files/FileWithVfsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp(): void
$this->file = new File($this->start . 'able/apple.php');
}

public function tearDown(): void
protected function tearDown(): void
{
parent::tearDown();

Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/DownloadResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
final class DownloadResponseTest extends CIUnitTestCase
{
public function tearDown(): void
protected function tearDown(): void
{
if (isset($_SERVER['HTTP_USER_AGENT'])) {
unset($_SERVER['HTTP_USER_AGENT']);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/Files/FileMovingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function setUp(): void
$_FILES = [];
}

public function tearDown(): void
protected function tearDown(): void
{
parent::tearDown();
$this->root = null;
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function setUp(): void

//--------------------------------------------------------------------

public function tearDown(): void
protected function tearDown(): void
{
$this->message = null;
unset($this->message);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/NegotiateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function setUp(): void

//--------------------------------------------------------------------

public function tearDown(): void
protected function tearDown(): void
{
$this->request = $this->negotiate = null;
unset($this->request, $this->negotiate);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function setUp(): void
$this->server = $_SERVER;
}

public function tearDown(): void
protected function tearDown(): void
{
$_SERVER = $this->server;
Factories::reset('config');
Expand Down
2 changes: 1 addition & 1 deletion tests/system/HTTP/URITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function setUp(): void

//--------------------------------------------------------------------

public function tearDown(): void
protected function tearDown(): void
{
Factories::reset('config');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Helpers/SecurityHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testStripImageTags()
$this->assertEquals('http://example.com/spacer.gif', strip_image_tags('<img src="http://example.com/spacer.gif" alt="Who needs CSS when you have a spacer.gif?" />'));
}

public function test_encode_php_tags()
public function testEncodePhpTags()
{
$this->assertEquals('&lt;? echo $foo; ?&gt;', encode_php_tags('<? echo $foo; ?>'));
}
Expand Down
Loading