Skip to content

Commit 453ec56

Browse files
authored
refactor: fix tests after smarter getPrivateMethodInvoker() return (#9491)
1 parent 0611c35 commit 453ec56

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tests/system/ControllerTest.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,17 @@ public function testConstructorHTTPS(): void
8989
$_SERVER = $original; // restore so code coverage doesn't break
9090
}
9191

92-
public function testCachePage(): void
92+
public function testCachePageSetsTtl(): void
9393
{
9494
$this->controller = new Controller();
9595
$this->controller->initController($this->request, $this->response, $this->logger);
9696

9797
$method = self::getPrivateMethodInvoker($this->controller, 'cachePage');
98-
$this->assertNull($method(10));
98+
99+
$this->assertSame(0, self::getPrivateProperty(service('responsecache'), 'ttl'));
100+
101+
$method(10);
102+
$this->assertSame(10, self::getPrivateProperty(service('responsecache'), 'ttl'));
99103
}
100104

101105
public function testValidate(): void

tests/system/Database/ConfigTest.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter\Database;
1515

16+
use CodeIgniter\Database\Postgre\Connection as PostgreConnection;
1617
use CodeIgniter\Test\CIUnitTestCase;
1718
use CodeIgniter\Test\ReflectionHelper;
1819
use PHPUnit\Framework\Attributes\DataProvider;
@@ -149,7 +150,7 @@ public function testConnectionGroupWithDSN(): void
149150
public function testConnectionGroupWithDSNPostgre(): void
150151
{
151152
$conn = Config::connect($this->dsnGroupPostgre, false);
152-
$this->assertInstanceOf(BaseConnection::class, $conn);
153+
$this->assertInstanceOf(PostgreConnection::class, $conn);
153154

154155
$this->assertSame('', $this->getPrivateProperty($conn, 'DSN'));
155156
$this->assertSame('localhost', $this->getPrivateProperty($conn, 'hostname'));
@@ -205,7 +206,7 @@ public function testConvertDSN(string $input, string $expected): void
205206
// Should deprecate?
206207
$this->dsnGroupPostgreNative['DSN'] = $input;
207208
$conn = Config::connect($this->dsnGroupPostgreNative, false);
208-
$this->assertInstanceOf(BaseConnection::class, $conn);
209+
$this->assertInstanceOf(PostgreConnection::class, $conn);
209210

210211
$method = self::getPrivateMethodInvoker($conn, 'convertDSN');
211212
$method();

0 commit comments

Comments
 (0)