From: colemanw Date: Wed, 27 Sep 2023 16:19:09 +0000 (-0400) Subject: APIv4 - Delete unnecessary contact spec provider X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3a4658a1b950b9db16a315119a94bc3bd6ab9bd1;p=civicrm-core.git APIv4 - Delete unnecessary contact spec provider --- diff --git a/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php b/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php deleted file mode 100644 index 15cb41cafd..0000000000 --- a/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php +++ /dev/null @@ -1,41 +0,0 @@ -getFieldByName('is_opt_out')->setRequired(FALSE); - $spec->getFieldByName('is_deleted')->setRequired(FALSE); - } - - /** - * @param string $entity - * @param string $action - * - * @return bool - */ - public function applies($entity, $action) { - return $entity === 'Contact' && $action === 'create'; - } - -} diff --git a/tests/phpunit/api/v4/Action/GetFieldsTest.php b/tests/phpunit/api/v4/Action/GetFieldsTest.php index becf8e1027..b12e26e068 100644 --- a/tests/phpunit/api/v4/Action/GetFieldsTest.php +++ b/tests/phpunit/api/v4/Action/GetFieldsTest.php @@ -60,6 +60,7 @@ class GetFieldsTest extends Api4TestBase implements TransactionalInterface { public function testContactGetFields(): void { $fields = Contact::getFields(FALSE) + ->setAction('create') ->execute() ->indexBy('name'); // Ensure table & column are returned @@ -71,6 +72,7 @@ class GetFieldsTest extends Api4TestBase implements TransactionalInterface { $this->assertEquals(['name', 'label', 'icon'], $fields['contact_sub_type']['suffixes']); // Check `required` and `nullable` + $this->assertFalse($fields['is_opt_out']['required']); $this->assertFalse($fields['is_deleted']['required']); $this->assertFalse($fields['is_deleted']['nullable']); $this->assertFalse($fields['id']['nullable']);