From 9180fd57955f6377312c653ddf456d6ae977cfe4 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 30 Aug 2023 14:01:24 +1200 Subject: [PATCH] Simplify test --- .../CRM/Utils/TokenConsistencyTest.php | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/tests/phpunit/CRM/Utils/TokenConsistencyTest.php b/tests/phpunit/CRM/Utils/TokenConsistencyTest.php index d33bb0a979..fffd067a54 100644 --- a/tests/phpunit/CRM/Utils/TokenConsistencyTest.php +++ b/tests/phpunit/CRM/Utils/TokenConsistencyTest.php @@ -1070,28 +1070,14 @@ United States', $tokenProcessor->getRow(0)->render('message')); } public function testEscaping(): void { - $autoClean = []; - $create = function(string $entity, array $record = []) use (&$autoClean) { - // It's convenient to use createTestObject(), but it doesn't reproduce the normal escaping rules from QuickForm/APIv3/APIv4. - CRM_Utils_API_HTMLInputCoder::singleton()->encodeRow($record); - $dao = CRM_Core_DAO::createTestObject(CRM_Core_DAO_AllCoreTables::getFullName($entity), $record); - - // We're not using transactions, and truncating 'contact' seems problematic, so we roll up our sleeves and cleanup each record... - $autoClean[] = CRM_Utils_AutoClean::with(function() use ($entity, $dao) { - CRM_Core_DAO::deleteTestObjects(CRM_Core_DAO_AllCoreTables::getFullName($entity), ['id' => $dao->id]); - }); - - return $dao; - }; - $context = []; - $context['contactId'] = $create('Contact', [ + $context['contactId'] = $this->individualCreate([ 'first_name' => 'igilly brackets', - ])->id; - $context['eventId'] = $create('Event', [ + ]); + $context['eventId'] = $this->eventCreateUnpaid([ 'title' => 'The Webinar', 'description' => '

Some online webinar thingy.

Attendees will need to install the TeleFoo app.

', - ])->id; + ])['id']; $messages = $expected = []; -- 2.25.1