@@ -72,7 +72,7 @@ public function testClassifyPgSelectAsRead(): void
7272 $ adapter ->setReadWriteSplit (true );
7373
7474 $ data = $ this ->buildPgQuery ('SELECT * FROM users ' );
75- $ this ->assertSame (QueryType::Read, $ adapter ->classifyQuery ($ data , 1 ));
75+ $ this ->assertSame (QueryType::Read, $ adapter ->classify ($ data , 1 ));
7676 }
7777
7878 public function testClassifyPgInsertAsWrite (): void
@@ -81,7 +81,7 @@ public function testClassifyPgInsertAsWrite(): void
8181 $ adapter ->setReadWriteSplit (true );
8282
8383 $ data = $ this ->buildPgQuery ("INSERT INTO users (name) VALUES ('x') " );
84- $ this ->assertSame (QueryType::Write, $ adapter ->classifyQuery ($ data , 1 ));
84+ $ this ->assertSame (QueryType::Write, $ adapter ->classify ($ data , 1 ));
8585 }
8686
8787 public function testClassifyMysqlSelectAsRead (): void
@@ -90,7 +90,7 @@ public function testClassifyMysqlSelectAsRead(): void
9090 $ adapter ->setReadWriteSplit (true );
9191
9292 $ data = $ this ->buildMySQLQuery ('SELECT * FROM users ' );
93- $ this ->assertSame (QueryType::Read, $ adapter ->classifyQuery ($ data , 1 ));
93+ $ this ->assertSame (QueryType::Read, $ adapter ->classify ($ data , 1 ));
9494 }
9595
9696 public function testClassifyMysqlInsertAsWrite (): void
@@ -99,7 +99,7 @@ public function testClassifyMysqlInsertAsWrite(): void
9999 $ adapter ->setReadWriteSplit (true );
100100
101101 $ data = $ this ->buildMySQLQuery ("INSERT INTO users (name) VALUES ('x') " );
102- $ this ->assertSame (QueryType::Write, $ adapter ->classifyQuery ($ data , 1 ));
102+ $ this ->assertSame (QueryType::Write, $ adapter ->classify ($ data , 1 ));
103103 }
104104
105105 public function testClassifyReturnsWriteWhenSplitDisabled (): void
@@ -108,7 +108,7 @@ public function testClassifyReturnsWriteWhenSplitDisabled(): void
108108 // Read/write split is disabled by default
109109
110110 $ data = $ this ->buildPgQuery ('SELECT * FROM users ' );
111- $ this ->assertSame (QueryType::Write, $ adapter ->classifyQuery ($ data , 1 ));
111+ $ this ->assertSame (QueryType::Write, $ adapter ->classify ($ data , 1 ));
112112 }
113113
114114 public function testBeginPinsConnectionToPrimary (): void
@@ -119,13 +119,13 @@ public function testBeginPinsConnectionToPrimary(): void
119119 $ clientFd = 42 ;
120120
121121 // Not pinned initially
122- $ this ->assertFalse ($ adapter ->isConnectionPinned ($ clientFd ));
122+ $ this ->assertFalse ($ adapter ->isPinned ($ clientFd ));
123123
124124 // BEGIN pins
125125 $ data = $ this ->buildPgQuery ('BEGIN ' );
126- $ result = $ adapter ->classifyQuery ($ data , $ clientFd );
126+ $ result = $ adapter ->classify ($ data , $ clientFd );
127127 $ this ->assertSame (QueryType::Write, $ result );
128- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ clientFd ));
128+ $ this ->assertTrue ($ adapter ->isPinned ($ clientFd ));
129129 }
130130
131131 public function testPinnedConnectionRoutesSelectToWrite (): void
@@ -136,12 +136,12 @@ public function testPinnedConnectionRoutesSelectToWrite(): void
136136 $ clientFd = 42 ;
137137
138138 // Begin transaction
139- $ adapter ->classifyQuery ($ this ->buildPgQuery ('BEGIN ' ), $ clientFd );
140- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ clientFd ));
139+ $ adapter ->classify ($ this ->buildPgQuery ('BEGIN ' ), $ clientFd );
140+ $ this ->assertTrue ($ adapter ->isPinned ($ clientFd ));
141141
142142 // SELECT should still route to WRITE when pinned
143143 $ data = $ this ->buildPgQuery ('SELECT * FROM users ' );
144- $ this ->assertSame (QueryType::Write, $ adapter ->classifyQuery ($ data , $ clientFd ));
144+ $ this ->assertSame (QueryType::Write, $ adapter ->classify ($ data , $ clientFd ));
145145 }
146146
147147 public function testCommitUnpinsConnection (): void
@@ -152,16 +152,16 @@ public function testCommitUnpinsConnection(): void
152152 $ clientFd = 42 ;
153153
154154 // Begin transaction
155- $ adapter ->classifyQuery ($ this ->buildPgQuery ('BEGIN ' ), $ clientFd );
156- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ clientFd ));
155+ $ adapter ->classify ($ this ->buildPgQuery ('BEGIN ' ), $ clientFd );
156+ $ this ->assertTrue ($ adapter ->isPinned ($ clientFd ));
157157
158158 // COMMIT unpins
159- $ adapter ->classifyQuery ($ this ->buildPgQuery ('COMMIT ' ), $ clientFd );
160- $ this ->assertFalse ($ adapter ->isConnectionPinned ($ clientFd ));
159+ $ adapter ->classify ($ this ->buildPgQuery ('COMMIT ' ), $ clientFd );
160+ $ this ->assertFalse ($ adapter ->isPinned ($ clientFd ));
161161
162162 // Now SELECT should route to READ again
163163 $ data = $ this ->buildPgQuery ('SELECT * FROM users ' );
164- $ this ->assertSame (QueryType::Read, $ adapter ->classifyQuery ($ data , $ clientFd ));
164+ $ this ->assertSame (QueryType::Read, $ adapter ->classify ($ data , $ clientFd ));
165165 }
166166
167167 public function testRollbackUnpinsConnection (): void
@@ -172,12 +172,12 @@ public function testRollbackUnpinsConnection(): void
172172 $ clientFd = 42 ;
173173
174174 // Begin transaction
175- $ adapter ->classifyQuery ($ this ->buildPgQuery ('BEGIN ' ), $ clientFd );
176- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ clientFd ));
175+ $ adapter ->classify ($ this ->buildPgQuery ('BEGIN ' ), $ clientFd );
176+ $ this ->assertTrue ($ adapter ->isPinned ($ clientFd ));
177177
178178 // ROLLBACK unpins
179- $ adapter ->classifyQuery ($ this ->buildPgQuery ('ROLLBACK ' ), $ clientFd );
180- $ this ->assertFalse ($ adapter ->isConnectionPinned ($ clientFd ));
179+ $ adapter ->classify ($ this ->buildPgQuery ('ROLLBACK ' ), $ clientFd );
180+ $ this ->assertFalse ($ adapter ->isPinned ($ clientFd ));
181181 }
182182
183183 public function testStartTransactionPinsConnection (): void
@@ -187,8 +187,8 @@ public function testStartTransactionPinsConnection(): void
187187
188188 $ clientFd = 42 ;
189189
190- $ adapter ->classifyQuery ($ this ->buildPgQuery ('START TRANSACTION ' ), $ clientFd );
191- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ clientFd ));
190+ $ adapter ->classify ($ this ->buildPgQuery ('START TRANSACTION ' ), $ clientFd );
191+ $ this ->assertTrue ($ adapter ->isPinned ($ clientFd ));
192192 }
193193
194194 public function testMysqlBeginPinsConnection (): void
@@ -198,8 +198,8 @@ public function testMysqlBeginPinsConnection(): void
198198
199199 $ clientFd = 42 ;
200200
201- $ adapter ->classifyQuery ($ this ->buildMySQLQuery ('BEGIN ' ), $ clientFd );
202- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ clientFd ));
201+ $ adapter ->classify ($ this ->buildMySQLQuery ('BEGIN ' ), $ clientFd );
202+ $ this ->assertTrue ($ adapter ->isPinned ($ clientFd ));
203203 }
204204
205205 public function testMysqlCommitUnpinsConnection (): void
@@ -209,11 +209,11 @@ public function testMysqlCommitUnpinsConnection(): void
209209
210210 $ clientFd = 42 ;
211211
212- $ adapter ->classifyQuery ($ this ->buildMySQLQuery ('BEGIN ' ), $ clientFd );
213- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ clientFd ));
212+ $ adapter ->classify ($ this ->buildMySQLQuery ('BEGIN ' ), $ clientFd );
213+ $ this ->assertTrue ($ adapter ->isPinned ($ clientFd ));
214214
215- $ adapter ->classifyQuery ($ this ->buildMySQLQuery ('COMMIT ' ), $ clientFd );
216- $ this ->assertFalse ($ adapter ->isConnectionPinned ($ clientFd ));
215+ $ adapter ->classify ($ this ->buildMySQLQuery ('COMMIT ' ), $ clientFd );
216+ $ this ->assertFalse ($ adapter ->isPinned ($ clientFd ));
217217 }
218218
219219 public function testClearConnectionStateRemovesPin (): void
@@ -223,11 +223,11 @@ public function testClearConnectionStateRemovesPin(): void
223223
224224 $ clientFd = 42 ;
225225
226- $ adapter ->classifyQuery ($ this ->buildPgQuery ('BEGIN ' ), $ clientFd );
227- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ clientFd ));
226+ $ adapter ->classify ($ this ->buildPgQuery ('BEGIN ' ), $ clientFd );
227+ $ this ->assertTrue ($ adapter ->isPinned ($ clientFd ));
228228
229- $ adapter ->clearConnectionState ($ clientFd );
230- $ this ->assertFalse ($ adapter ->isConnectionPinned ($ clientFd ));
229+ $ adapter ->clearState ($ clientFd );
230+ $ this ->assertFalse ($ adapter ->isPinned ($ clientFd ));
231231 }
232232
233233 public function testPinningIsPerConnection (): void
@@ -239,15 +239,15 @@ public function testPinningIsPerConnection(): void
239239 $ fd2 = 2 ;
240240
241241 // Pin fd1
242- $ adapter ->classifyQuery ($ this ->buildPgQuery ('BEGIN ' ), $ fd1 );
243- $ this ->assertTrue ($ adapter ->isConnectionPinned ($ fd1 ));
244- $ this ->assertFalse ($ adapter ->isConnectionPinned ($ fd2 ));
242+ $ adapter ->classify ($ this ->buildPgQuery ('BEGIN ' ), $ fd1 );
243+ $ this ->assertTrue ($ adapter ->isPinned ($ fd1 ));
244+ $ this ->assertFalse ($ adapter ->isPinned ($ fd2 ));
245245
246246 // fd2 can still read
247- $ this ->assertSame (QueryType::Read, $ adapter ->classifyQuery ($ this ->buildPgQuery ('SELECT 1 ' ), $ fd2 ));
247+ $ this ->assertSame (QueryType::Read, $ adapter ->classify ($ this ->buildPgQuery ('SELECT 1 ' ), $ fd2 ));
248248
249249 // fd1 is pinned to write
250- $ this ->assertSame (QueryType::Write, $ adapter ->classifyQuery ($ this ->buildPgQuery ('SELECT 1 ' ), $ fd1 ));
250+ $ this ->assertSame (QueryType::Write, $ adapter ->classify ($ this ->buildPgQuery ('SELECT 1 ' ), $ fd1 ));
251251 }
252252
253253 public function testRouteQueryReadUsesReadEndpoint (): void
@@ -315,11 +315,11 @@ public function testSetCommandRoutesToPrimaryButDoesNotPin(): void
315315 $ clientFd = 42 ;
316316
317317 // SET is a transaction-class command, routes to primary
318- $ result = $ adapter ->classifyQuery ($ this ->buildPgQuery ("SET search_path = 'public' " ), $ clientFd );
318+ $ result = $ adapter ->classify ($ this ->buildPgQuery ("SET search_path = 'public' " ), $ clientFd );
319319 $ this ->assertSame (QueryType::Write, $ result );
320320
321321 // But SET should not pin the connection (only BEGIN/START pin)
322- $ this ->assertFalse ($ adapter ->isConnectionPinned ($ clientFd ));
322+ $ this ->assertFalse ($ adapter ->isPinned ($ clientFd ));
323323 }
324324
325325 public function testUnknownQueryRoutesToWrite (): void
@@ -329,7 +329,7 @@ public function testUnknownQueryRoutesToWrite(): void
329329
330330 // Use an unknown PG message type
331331 $ data = 'X ' . \pack ('N ' , 5 ) . "\x00" ;
332- $ result = $ adapter ->classifyQuery ($ data , 1 );
332+ $ result = $ adapter ->classify ($ data , 1 );
333333 $ this ->assertSame (QueryType::Write, $ result );
334334 }
335335}
0 commit comments