From a5d7518eb6635fa508c0d212cd2338b0e2f584ee Mon Sep 17 00:00:00 2001 From: Mark Story Date: Tue, 27 Dec 2022 15:42:47 -0500 Subject: [PATCH] Update dependencies and use fetchTable() - Update dependency to reflect new branch name. - Use fetchTable() instead of the more verbose `getTableLocator()->get()`. --- composer.json | 2 +- src/Panel/HistoryPanel.php | 2 +- src/ToolbarService.php | 2 +- tests/TestCase/Controller/DashboardControllerTest.php | 4 ++-- tests/TestCase/Controller/MailPreviewControllerTest.php | 4 ++-- tests/TestCase/Controller/PanelsControllerTest.php | 2 +- tests/TestCase/DebugSqlTest.php | 2 +- tests/TestCase/Model/Behavior/TimedBehaviorTest.php | 2 +- tests/TestCase/Model/Table/RequestTableTest.php | 6 +++--- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 3f6209bcd..8faa34958 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "doctrine/sql-formatter": "^1.1.3" }, "require-dev": { - "cakephp/authorization": "dev-cake5", + "cakephp/authorization": "3.x-dev", "cakephp/cakephp-codesniffer": "5.x-dev", "phpunit/phpunit": "^9.5.19" }, diff --git a/src/Panel/HistoryPanel.php b/src/Panel/HistoryPanel.php index 6453e7692..52e5984a0 100644 --- a/src/Panel/HistoryPanel.php +++ b/src/Panel/HistoryPanel.php @@ -31,7 +31,7 @@ class HistoryPanel extends DebugPanel */ public function data(): array { - $table = $this->getTableLocator()->get('DebugKit.Requests'); + $table = $this->fetchTable('DebugKit.Requests'); $recent = $table->find('recent'); return [ diff --git a/src/ToolbarService.php b/src/ToolbarService.php index cd9577ae7..46321e55c 100644 --- a/src/ToolbarService.php +++ b/src/ToolbarService.php @@ -267,7 +267,7 @@ public function saveData(ServerRequest $request, ResponseInterface $response): R ]; try { /** @var \DebugKit\Model\Table\RequestsTable $requests */ - $requests = $this->getTableLocator()->get('DebugKit.Requests'); + $requests = $this->fetchTable('DebugKit.Requests'); $requests->gc(); } catch (MissingDatasourceConfigException $e) { Log::warning( diff --git a/tests/TestCase/Controller/DashboardControllerTest.php b/tests/TestCase/Controller/DashboardControllerTest.php index f0491112d..8ae9bf282 100644 --- a/tests/TestCase/Controller/DashboardControllerTest.php +++ b/tests/TestCase/Controller/DashboardControllerTest.php @@ -51,7 +51,7 @@ public function setUp(): void public function testIndexNoRequests() { - $requests = $this->getTableLocator()->get('DebugKit.Requests'); + $requests = $this->fetchTable('DebugKit.Requests'); $requests->Panels->deleteAll('1=1'); $requests->deleteAll('1=1'); @@ -82,7 +82,7 @@ public function testReset() $this->post('/debug-kit/dashboard/reset'); $this->assertRedirect('/debug-kit'); - $requests = $this->getTableLocator()->get('DebugKit.Requests'); + $requests = $this->fetchTable('DebugKit.Requests'); $this->assertSame(0, $requests->find()->count()); } } diff --git a/tests/TestCase/Controller/MailPreviewControllerTest.php b/tests/TestCase/Controller/MailPreviewControllerTest.php index f9d34aa5d..f5c1801f1 100644 --- a/tests/TestCase/Controller/MailPreviewControllerTest.php +++ b/tests/TestCase/Controller/MailPreviewControllerTest.php @@ -97,7 +97,7 @@ public function testSentInvalidData() */ public function testSentValidData() { - $panels = $this->getTableLocator()->get('DebugKit.Panels'); + $panels = $this->fetchTable('DebugKit.Panels'); $request = $this->makeRequest(); $panel = $panels->newEntity(['request_id' => $request->id]); $data = [ @@ -124,7 +124,7 @@ public function testSentValidData() */ public function testSentValidDataRenderPart() { - $panels = $this->getTableLocator()->get('DebugKit.Panels'); + $panels = $this->fetchTable('DebugKit.Panels'); $request = $this->makeRequest(); $panel = $panels->newEntity(['request_id' => $request->id]); $data = [ diff --git a/tests/TestCase/Controller/PanelsControllerTest.php b/tests/TestCase/Controller/PanelsControllerTest.php index 8a9055723..6375ad50f 100644 --- a/tests/TestCase/Controller/PanelsControllerTest.php +++ b/tests/TestCase/Controller/PanelsControllerTest.php @@ -103,7 +103,7 @@ public function testViewNotExists() */ public function testLatestHistory() { - $request = $this->getTableLocator()->get('DebugKit.Requests')->find('recent')->first(); + $request = $this->fetchTable('DebugKit.Requests')->find('recent')->first(); if (!$request) { $request = $this->makeRequest(); } diff --git a/tests/TestCase/DebugSqlTest.php b/tests/TestCase/DebugSqlTest.php index e2b240e5d..185c26f10 100644 --- a/tests/TestCase/DebugSqlTest.php +++ b/tests/TestCase/DebugSqlTest.php @@ -138,6 +138,6 @@ public function testSqlPlain() */ private function newQuery() { - return $this->getTableLocator()->get('panels')->query(); + return $this->fetchTable('panels')->query(); } } diff --git a/tests/TestCase/Model/Behavior/TimedBehaviorTest.php b/tests/TestCase/Model/Behavior/TimedBehaviorTest.php index cecba3fcf..b2996c721 100644 --- a/tests/TestCase/Model/Behavior/TimedBehaviorTest.php +++ b/tests/TestCase/Model/Behavior/TimedBehaviorTest.php @@ -36,7 +36,7 @@ class TimedBehaviorTest extends TestCase public function setUp(): void { parent::setUp(); - $this->Article = $this->getTableLocator()->get('Articles'); + $this->Article = $this->fetchTable('Articles'); $this->Article->addBehavior('DebugKit.Timed'); } diff --git a/tests/TestCase/Model/Table/RequestTableTest.php b/tests/TestCase/Model/Table/RequestTableTest.php index ca8f49a82..8602e40e5 100644 --- a/tests/TestCase/Model/Table/RequestTableTest.php +++ b/tests/TestCase/Model/Table/RequestTableTest.php @@ -53,8 +53,8 @@ public function testInitializeCreatesSchema() $stmt = $connection->execute('DROP TABLE IF EXISTS requests'); $stmt->closeCursor(); - $this->getTableLocator()->get('DebugKit.Requests'); - $this->getTableLocator()->get('DebugKit.Panels'); + $this->fetchTable('DebugKit.Requests'); + $this->fetchTable('DebugKit.Panels'); $schema = $connection->getSchemaCollection(); $this->assertContains('requests', $schema->listTables()); @@ -68,7 +68,7 @@ public function testInitializeCreatesSchema() */ public function testFindRecent() { - $table = $this->getTableLocator()->get('DebugKit.Requests'); + $table = $this->fetchTable('DebugKit.Requests'); $query = $table->find('recent'); $this->assertSame(10, $query->clause('limit')); $this->assertNotEmpty($query->clause('order'));