@@ -45,7 +45,7 @@ protected function tearDown(): void
4545 {
4646 parent ::tearDown ();
4747
48- if ($ this ->query === null ) {
48+ if (! $ this ->query instanceof BasePreparedQuery ) {
4949 return ;
5050 }
5151
@@ -115,11 +115,13 @@ public function testPrepareReturnsManualPreparedQuery(): void
115115
116116 public function testPrepareAndExecuteManualQueryWithNamedPlaceholdersKeepsTimeLiteral (): void
117117 {
118- $ this ->query = $ this ->db ->prepare (static function ($ db ): Query {
118+ // Quote alias to keep a consistent property name across drivers (OCI8 uppercases unquoted aliases)
119+ $ timeValue = $ this ->db ->protectIdentifiers ('time_value ' );
120+ $ this ->query = $ this ->db ->prepare (static function ($ db ) use ($ timeValue ): Query {
119121 $ sql = 'SELECT '
120122 . $ db ->protectIdentifiers ('name ' ) . ', '
121123 . $ db ->protectIdentifiers ('email ' )
122- . ", '12:34' AS time_value "
124+ . ", '12:34' AS " . $ timeValue . ' '
123125 . 'FROM ' . $ db ->protectIdentifiers ($ db ->DBPrefix . 'user ' )
124126 . ' WHERE '
125127 . $ db ->protectIdentifiers ('name ' ) . ' = :name: '
@@ -130,7 +132,7 @@ public function testPrepareAndExecuteManualQueryWithNamedPlaceholdersKeepsTimeLi
130132
131133 $ preparedSql = $ this ->query ->getQueryString ();
132134
133- $ this ->assertStringContainsString ("'12:34' AS time_value " , $ preparedSql );
135+ $ this ->assertStringContainsString ("'12:34' AS " . $ timeValue , $ preparedSql );
134136
135137 if ($ this ->db ->DBDriver === 'Postgre ' ) {
136138 $ this ->assertStringContainsString (' = $1 ' , $ preparedSql );
0 commit comments