Skip to content
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
2 changes: 1 addition & 1 deletion tests/system/API/ResponseTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ public function testXMLResponseFormat(): void

private function invoke(object $controller, string $method, array $args = [])
{
$method = $this->getPrivateMethodInvoker($controller, $method);
$method = self::getPrivateMethodInvoker($controller, $method);

return $method(...$args);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/system/Autoloader/AutoloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function setUp(): void
$this->loader = new Autoloader();
$this->loader->initialize($config, $modules)->register();

$this->classLoader = $this->getPrivateMethodInvoker($this->loader, 'loadInNamespace');
$this->classLoader = self::getPrivateMethodInvoker($this->loader, 'loadInNamespace');
}

protected function tearDown(): void
Expand Down Expand Up @@ -111,7 +111,7 @@ public function testInitializeTwice(): void

public function testServiceAutoLoaderFromShareInstances(): void
{
$classLoader = $this->getPrivateMethodInvoker(service('autoloader'), 'loadInNamespace');
$classLoader = self::getPrivateMethodInvoker(service('autoloader'), 'loadInNamespace');

// look for Home controller, as that should be in base repo
$actual = $classLoader(Home::class);
Expand All @@ -129,7 +129,7 @@ public function testServiceAutoLoader(): void
$autoloader->initialize(new Autoload(), new Modules());
$autoloader->register();

$classLoader = $this->getPrivateMethodInvoker($autoloader, 'loadInNamespace');
$classLoader = self::getPrivateMethodInvoker($autoloader, 'loadInNamespace');

// look for Home controller, as that should be in base repo
$actual = $classLoader(Home::class);
Expand Down
6 changes: 3 additions & 3 deletions tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ public function testRunForceSecure(): void
$codeigniter = new MockCodeIgniter($config);
$codeigniter->setContext('web');

$this->getPrivateMethodInvoker($codeigniter, 'getRequestObject')();
$this->getPrivateMethodInvoker($codeigniter, 'getResponseObject')();
self::getPrivateMethodInvoker($codeigniter, 'getRequestObject')();
self::getPrivateMethodInvoker($codeigniter, 'getResponseObject')();

$response = $this->getPrivateProperty($codeigniter, 'response');
$this->assertNull($response->header('Location'));
Expand Down Expand Up @@ -949,7 +949,7 @@ public function testStartControllerPermitsInvoke(): void
{
$this->setPrivateProperty($this->codeigniter, 'benchmark', new Timer());
$this->setPrivateProperty($this->codeigniter, 'controller', '\\' . Home::class);
$startController = $this->getPrivateMethodInvoker($this->codeigniter, 'startController');
$startController = self::getPrivateMethodInvoker($this->codeigniter, 'startController');

$this->setPrivateProperty($this->codeigniter, 'method', '__invoke');
$startController();
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Commands/Translation/LocalizationSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function testProcessWithInvalidOption(): void
$langPath = SUPPORTPATH . 'Language';
$command = new LocalizationSync(service('logger'), service('commands'));
$this->setPrivateProperty($command, 'languagePath', $langPath);
$runner = $this->getPrivateMethodInvoker($command, 'process');
$runner = self::getPrivateMethodInvoker($command, 'process');

$status = $runner('de', 'jp');

Expand Down
4 changes: 2 additions & 2 deletions tests/system/Commands/Utilities/ConfigCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function testConfigCheckWithKintEnabledUsesKintD(): void
/**
* @var Closure(mixed...): string
*/
$command = $this->getPrivateMethodInvoker(
$command = self::getPrivateMethodInvoker(
new ConfigCheck(service('logger'), service('commands')),
'getKintD',
);
Expand All @@ -110,7 +110,7 @@ public function testConfigCheckWithKintDisabledUsesVarDump(): void
/**
* @var Closure(mixed...): string
*/
$command = $this->getPrivateMethodInvoker(
$command = self::getPrivateMethodInvoker(
new ConfigCheck(service('logger'), service('commands')),
'getVarDump',
);
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Commands/Utilities/NamespacesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testNamespacesCommandAllNamespaces(): void
public function testTruncateNamespaces(): void
{
$commandObject = new Namespaces(service('logger'), service('commands'));
$truncateRunner = $this->getPrivateMethodInvoker($commandObject, 'truncate');
$truncateRunner = self::getPrivateMethodInvoker($commandObject, 'truncate');

$this->assertSame('App\Controllers\...', $truncateRunner('App\Controllers\Admin', 19));
// multibyte namespace
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Config/BaseConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function testRegistrars(): void
$config = new RegistrarConfig();
$config::$registrars = [TestRegistrar::class];
$this->setPrivateProperty($config, 'didDiscovery', true);
$method = $this->getPrivateMethodInvoker($config, 'registerProperties');
$method = self::getPrivateMethodInvoker($config, 'registerProperties');
$method();

// no change to unmodified property
Expand All @@ -274,7 +274,7 @@ public function testBadRegistrar(): void
$this->setPrivateProperty($config, 'didDiscovery', true);

$this->expectException(RuntimeException::class);
$method = $this->getPrivateMethodInvoker($config, 'registerProperties');
$method = self::getPrivateMethodInvoker($config, 'registerProperties');
$method();

$this->assertSame('bar', $config->foo);
Expand Down
16 changes: 8 additions & 8 deletions tests/system/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testCachePage(): void
$this->controller = new Controller();
$this->controller->initController($this->request, $this->response, $this->logger);

$method = $this->getPrivateMethodInvoker($this->controller, 'cachePage');
$method = self::getPrivateMethodInvoker($this->controller, 'cachePage');
$this->assertNull($method(10));
}

Expand All @@ -105,7 +105,7 @@ public function testValidate(): void
$this->controller->initController($this->request, $this->response, $this->logger);

// and that we can attempt validation, with no rules
$method = $this->getPrivateMethodInvoker($this->controller, 'validate');
$method = self::getPrivateMethodInvoker($this->controller, 'validate');
$this->assertFalse($method([]));
}

Expand All @@ -117,7 +117,7 @@ public function testValidateWithStringRulesNotFound(): void
$this->controller = new Controller();
$this->controller->initController($this->request, $this->response, $this->logger);

$method = $this->getPrivateMethodInvoker($this->controller, 'validate');
$method = self::getPrivateMethodInvoker($this->controller, 'validate');
$this->assertFalse($method('signup'));
}

Expand Down Expand Up @@ -146,7 +146,7 @@ public function testValidateWithStringRulesFoundReadMessagesFromValidationConfig
$this->controller = new Controller();
$this->controller->initController($this->request, $this->response, $this->logger);

$method = $this->getPrivateMethodInvoker($this->controller, 'validate');
$method = self::getPrivateMethodInvoker($this->controller, 'validate');
$this->assertFalse($method('signup'));
$this->assertSame('You must choose a username.', service('validation')->getError('username'));
}
Expand All @@ -167,7 +167,7 @@ public function testValidateWithStringRulesFoundUseMessagesParameter(): void
$this->controller = new Controller();
$this->controller->initController($this->request, $this->response, $this->logger);

$method = $this->getPrivateMethodInvoker($this->controller, 'validate');
$method = self::getPrivateMethodInvoker($this->controller, 'validate');
$this->assertFalse($method('signup', [
'username' => [
'required' => 'You must choose a username.',
Expand All @@ -182,7 +182,7 @@ public function testValidateData(): void
$this->controller = new Controller();
$this->controller->initController($this->request, $this->response, $this->logger);

$method = $this->getPrivateMethodInvoker($this->controller, 'validateData');
$method = self::getPrivateMethodInvoker($this->controller, 'validateData');

$data = [
'username' => 'mike',
Expand All @@ -205,7 +205,7 @@ public function testValidateDataWithCustomErrorMessage(): void
$this->controller = new Controller();
$this->controller->initController($this->request, $this->response, $this->logger);

$method = $this->getPrivateMethodInvoker($this->controller, 'validateData');
$method = self::getPrivateMethodInvoker($this->controller, 'validateData');

$data = [
'username' => 'a',
Expand Down Expand Up @@ -238,7 +238,7 @@ public function testValidateDataWithCustomErrorMessageLabeledStyle(): void
$this->controller = new Controller();
$this->controller->initController($this->request, $this->response, $this->logger);

$method = $this->getPrivateMethodInvoker($this->controller, 'validateData');
$method = self::getPrivateMethodInvoker($this->controller, 'validateData');

$data = [
'username' => 'a',
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Database/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function testConnectionGroupWithDSNPostgre(): void
$this->assertSame('5', $this->getPrivateProperty($conn, 'connect_timeout'));
$this->assertSame('1', $this->getPrivateProperty($conn, 'sslmode'));

$method = $this->getPrivateMethodInvoker($conn, 'buildDSN');
$method = self::getPrivateMethodInvoker($conn, 'buildDSN');
$method();

$expected = "host=localhost port=5432 user=user password='pass' dbname=dbname connect_timeout='5' sslmode='1'";
Expand Down Expand Up @@ -207,7 +207,7 @@ public function testConvertDSN(string $input, string $expected): void
$conn = Config::connect($this->dsnGroupPostgreNative, false);
$this->assertInstanceOf(BaseConnection::class, $conn);

$method = $this->getPrivateMethodInvoker($conn, 'convertDSN');
$method = self::getPrivateMethodInvoker($conn, 'convertDSN');
$method();

$this->assertSame($expected, $this->getPrivateProperty($conn, 'DSN'));
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Live/ForgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public function testCreateTableWithNullableFieldsGivesNullDataType(): void
],
]);

$createTable = $this->getPrivateMethodInvoker($this->forge, '_createTable');
$createTable = self::getPrivateMethodInvoker($this->forge, '_createTable');

$sql = $createTable('forge_nullable_table', false, []);

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Live/OCI8/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testIsValidDSN(string $dsn): void

$db = new Connection($this->settings);

$isValidDSN = $this->getPrivateMethodInvoker($db, 'isValidDSN');
$isValidDSN = self::getPrivateMethodInvoker($db, 'isValidDSN');

$this->assertTrue($isValidDSN());
}
Expand Down
12 changes: 6 additions & 6 deletions tests/system/Database/Migrations/MigrationRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function testGetMigrationNumberAllDigits(): void
{
$runner = new MigrationRunner($this->config);

$method = $this->getPrivateMethodInvoker($runner, 'getMigrationNumber');
$method = self::getPrivateMethodInvoker($runner, 'getMigrationNumber');

$this->assertSame('20190806235100', $method('20190806235100_Foo'));
}
Expand All @@ -165,7 +165,7 @@ public function testGetMigrationNumberDashes(): void
{
$runner = new MigrationRunner($this->config);

$method = $this->getPrivateMethodInvoker($runner, 'getMigrationNumber');
$method = self::getPrivateMethodInvoker($runner, 'getMigrationNumber');

$this->assertSame('2019-08-06-235100', $method('2019-08-06-235100_Foo'));
}
Expand All @@ -174,7 +174,7 @@ public function testGetMigrationNumberUnderscores(): void
{
$runner = new MigrationRunner($this->config);

$method = $this->getPrivateMethodInvoker($runner, 'getMigrationNumber');
$method = self::getPrivateMethodInvoker($runner, 'getMigrationNumber');

$this->assertSame('2019_08_06_235100', $method('2019_08_06_235100_Foo'));
}
Expand All @@ -183,7 +183,7 @@ public function testGetMigrationNumberReturnsZeroIfNoneFound(): void
{
$runner = new MigrationRunner($this->config);

$method = $this->getPrivateMethodInvoker($runner, 'getMigrationNumber');
$method = self::getPrivateMethodInvoker($runner, 'getMigrationNumber');

$this->assertSame('0', $method('Foo'));
}
Expand All @@ -192,7 +192,7 @@ public function testGetMigrationNameDashes(): void
{
$runner = new MigrationRunner($this->config);

$method = $this->getPrivateMethodInvoker($runner, 'getMigrationName');
$method = self::getPrivateMethodInvoker($runner, 'getMigrationName');

$this->assertSame('Foo_bar', $method('2019-08-06-235100_Foo_bar'));
}
Expand All @@ -201,7 +201,7 @@ public function testGetMigrationNameUnderscores(): void
{
$runner = new MigrationRunner($this->config);

$method = $this->getPrivateMethodInvoker($runner, 'getMigrationName');
$method = self::getPrivateMethodInvoker($runner, 'getMigrationName');

$this->assertSame('Foo_bar', $method('2019_08_06_235100_Foo_bar'));
}
Expand Down
16 changes: 8 additions & 8 deletions tests/system/Debug/ExceptionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function setUp(): void

public function testDetermineViewsPageNotFoundException(): void
{
$determineView = $this->getPrivateMethodInvoker($this->handler, 'determineView');
$determineView = self::getPrivateMethodInvoker($this->handler, 'determineView');

$exception = PageNotFoundException::forControllerNotFound('Foo', 'bar');
$templatePath = APPPATH . 'Views/errors/html';
Expand All @@ -54,7 +54,7 @@ public function testDetermineViewsPageNotFoundException(): void

public function testDetermineViewsRuntimeException(): void
{
$determineView = $this->getPrivateMethodInvoker($this->handler, 'determineView');
$determineView = self::getPrivateMethodInvoker($this->handler, 'determineView');

$exception = new RuntimeException('Exception');
$templatePath = APPPATH . 'Views/errors/html';
Expand All @@ -65,7 +65,7 @@ public function testDetermineViewsRuntimeException(): void

public function testDetermineViewsRuntimeExceptionCode404(): void
{
$determineView = $this->getPrivateMethodInvoker($this->handler, 'determineView');
$determineView = self::getPrivateMethodInvoker($this->handler, 'determineView');

$exception = new RuntimeException('foo', 404);
$templatePath = APPPATH . 'Views/errors/html';
Expand All @@ -78,7 +78,7 @@ public function testDetermineViewsDisplayErrorsOffRuntimeException(): void
{
ini_set('display_errors', '0');

$determineView = $this->getPrivateMethodInvoker($this->handler, 'determineView');
$determineView = self::getPrivateMethodInvoker($this->handler, 'determineView');

$exception = new RuntimeException('Exception');
$templatePath = APPPATH . 'Views/errors/html';
Expand All @@ -91,7 +91,7 @@ public function testDetermineViewsDisplayErrorsOffRuntimeException(): void

public function testCollectVars(): void
{
$collectVars = $this->getPrivateMethodInvoker($this->handler, 'collectVars');
$collectVars = self::getPrivateMethodInvoker($this->handler, 'collectVars');

$vars = $collectVars(new RuntimeException('This.'), 404);

Expand Down Expand Up @@ -163,7 +163,7 @@ public function testHandleCLIPageNotFoundException(): void

public function testMaskSensitiveData(): void
{
$maskSensitiveData = $this->getPrivateMethodInvoker($this->handler, 'maskSensitiveData');
$maskSensitiveData = self::getPrivateMethodInvoker($this->handler, 'maskSensitiveData');

$trace = [
0 => [
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testMaskSensitiveData(): void

public function testMaskSensitiveDataTraceDataKey(): void
{
$maskSensitiveData = $this->getPrivateMethodInvoker($this->handler, 'maskSensitiveData');
$maskSensitiveData = self::getPrivateMethodInvoker($this->handler, 'maskSensitiveData');

$trace = [
0 => [
Expand Down Expand Up @@ -248,7 +248,7 @@ public function testHighlightFile(): void
'highlight.comment', 'highlight.default', 'highlight.html', 'highlight.keyword', 'highlight.string',
]);

$highlightFile = $this->getPrivateMethodInvoker($this->handler, 'highlightFile');
$highlightFile = self::getPrivateMethodInvoker($this->handler, 'highlightFile');
$result = $highlightFile(SUPPORTPATH . 'Controllers' . DIRECTORY_SEPARATOR . 'Hello.php', 16);

$resultFile = match (true) {
Expand Down
10 changes: 5 additions & 5 deletions tests/system/Debug/ExceptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function testSuppressedDeprecationsAreLogged(): void

public function testDetermineViews(): void
{
$determineView = $this->getPrivateMethodInvoker($this->exception, 'determineView');
$determineView = self::getPrivateMethodInvoker($this->exception, 'determineView');

$this->assertSame('error_404.php', $determineView(PageNotFoundException::forControllerNotFound('Foo', 'bar'), ''));
$this->assertSame('error_exception.php', $determineView(new RuntimeException('Exception'), ''));
Expand All @@ -105,7 +105,7 @@ public function testDetermineViews(): void

public function testCollectVars(): void
{
$vars = $this->getPrivateMethodInvoker($this->exception, 'collectVars')(new RuntimeException('This.'), 404);
$vars = self::getPrivateMethodInvoker($this->exception, 'collectVars')(new RuntimeException('This.'), 404);

$this->assertIsArray($vars);
$this->assertCount(7, $vars);
Expand All @@ -117,7 +117,7 @@ public function testCollectVars(): void

public function testDetermineCodes(): void
{
$determineCodes = $this->getPrivateMethodInvoker($this->exception, 'determineCodes');
$determineCodes = self::getPrivateMethodInvoker($this->exception, 'determineCodes');

$this->assertSame([500, EXIT_ERROR], $determineCodes(new RuntimeException('This.')));
$this->assertSame([500, EXIT_ERROR], $determineCodes(new RuntimeException('That.', 600)));
Expand Down Expand Up @@ -146,7 +146,7 @@ public function testRenderBacktrace(): void

public function testMaskSensitiveData(): void
{
$maskSensitiveData = $this->getPrivateMethodInvoker($this->exception, 'maskSensitiveData');
$maskSensitiveData = self::getPrivateMethodInvoker($this->exception, 'maskSensitiveData');

$trace = [
0 => [
Expand Down Expand Up @@ -195,7 +195,7 @@ public function testMaskSensitiveData(): void

public function testMaskSensitiveDataTraceDataKey(): void
{
$maskSensitiveData = $this->getPrivateMethodInvoker($this->exception, 'maskSensitiveData');
$maskSensitiveData = self::getPrivateMethodInvoker($this->exception, 'maskSensitiveData');

$trace = [
0 => [
Expand Down
Loading
Loading