mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-10 04:16:13 +01:00

[CLEANUP] Use prepared statements for SQL queries in the tests (#443)

Also add another type check to help with debugging failed queries.
This commit is contained in:
Oliver Klee 2022-04-29 14:27:47 +02:00 committed by GitHub
parent 6d6b196426
commit f1a0fbef04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -129,14 +129,15 @@ class TeaRepositoryTest extends FunctionalTestCase
$this->subject->add($model); $this->subject->add($model);
$this->persistenceManager->persistAll(); $this->persistenceManager->persistAll();
$connection = $this->getConnectionPool() $connection = $this->getConnectionPool()->getConnectionForTable('tx_tea_domain_model_product_tea');
->getConnectionForTable('tx_tea_domain_model_product_tea');
$databaseRow = $connection $databaseRow = $connection
->executeQuery( ->executeQuery(
'SELECT * FROM tx_tea_domain_model_product_tea WHERE uid = ' . $model->getUid() 'SELECT * FROM tx_tea_domain_model_product_tea WHERE uid = :uid',
['uid' => $model->getUid()]
) )
->fetchAssociative(); ->fetchAssociative();
self::assertIsArray($databaseRow);
self::assertSame($title, $databaseRow['title']); self::assertSame($title, $databaseRow['title']);
} }
} }