From c171bf316300315f968af2a099bb5c97bff54b92 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 10 Sep 2016 08:21:24 +1000 Subject: [PATCH] Update test to use new lastInesrtId function --- tests/phpunit/CRM/Core/TransactionTest.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tests/phpunit/CRM/Core/TransactionTest.php b/tests/phpunit/CRM/Core/TransactionTest.php index a589c932e2..43d109a081 100644 --- a/tests/phpunit/CRM/Core/TransactionTest.php +++ b/tests/phpunit/CRM/Core/TransactionTest.php @@ -362,16 +362,7 @@ class CRM_Core_TransactionTest extends CiviUnitTestCase { if ($insert == 'sql-insert') { $r = CRM_Core_DAO::executeQuery("INSERT INTO civicrm_contact(first_name,last_name) VALUES ('ff', 'll')"); - $mysqlFunction = strstr(CRM_Core_Config::singleton()->dsn, 'mysqli') ? 'mysqli_insert_id' : 'mysql_insert_id'; - if ($mysqlFunction == 'mysql_insert_id' && phpversion() >= 7) { - CRM_Core_Exception('Current DSN in compatible with the PHP version, need to update to use mysqli'); - } - if ($mysqlFunction == 'mysqli_insert_id') { - $cid = mysqli_insert_id($r->getConnection()->connection); - } - else { - $cid = mysql_insert_id(); - } + $cid = $r->getConnection()->lastInsertId(); } elseif ($insert == 'bao-create') { $params = array( -- 2.25.1