From f9f085b81c8b6e697605d04c65d3ce970e3f113a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 1 Mar 2022 18:58:26 -0800 Subject: [PATCH] CustomValueTest - Highlight cache bug --- .../phpunit/api/v4/Action/CustomValueTest.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/phpunit/api/v4/Action/CustomValueTest.php b/tests/phpunit/api/v4/Action/CustomValueTest.php index 337cc3c590..f774d3acce 100644 --- a/tests/phpunit/api/v4/Action/CustomValueTest.php +++ b/tests/phpunit/api/v4/Action/CustomValueTest.php @@ -263,4 +263,36 @@ class CustomValueTest extends BaseCustomValueTest { $this->assertEquals(0, count($result)); } + /** + * Whenever a CustomGroup toggles the `is_multiple` flag, the entity-list should be updated. + * + * @throws \API_Exception + * @throws \Civi\API\Exception\UnauthorizedException + */ + public function testEntityRefresh() { + $groupName = uniqid('groupc'); + + $this->assertNotContains("Custom_$groupName", Entity::get()->execute()->column('name')); + + CustomGroup::create(FALSE) + ->addValue('title', $groupName) + ->addValue('extends', 'Contact') + ->addValue('is_multiple', FALSE) + ->execute(); + + $this->assertNotContains("Custom_$groupName", Entity::get()->execute()->column('name')); + + CustomGroup::update(FALSE) + ->addWhere('name', '=', $groupName) + ->addValue('is_multiple', TRUE) + ->execute(); + $this->assertContains("Custom_$groupName", Entity::get()->execute()->column('name')); + + CustomGroup::update(FALSE) + ->addWhere('name', '=', $groupName) + ->addValue('is_multiple', FALSE) + ->execute(); + $this->assertNotContains("Custom_$groupName", Entity::get()->execute()->column('name')); + } + } -- 2.25.1