From dbdc3edda05d4acd69c4b0b8b210cf771559f67d Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 10 Nov 2022 10:22:34 +1300 Subject: [PATCH] Add new Organization Example contact (The Daily Bugle) --- Civi/Test/EntityExample.php | 9 ++++ .../ExampleData/Contact/TheDailyBugle.php | 42 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 Civi/Test/ExampleData/Contact/TheDailyBugle.php diff --git a/Civi/Test/EntityExample.php b/Civi/Test/EntityExample.php index 930f5972a0..71429867e3 100644 --- a/Civi/Test/EntityExample.php +++ b/Civi/Test/EntityExample.php @@ -24,6 +24,15 @@ abstract class EntityExample implements ExampleDataInterface { */ protected $exName; + /** + * Get the name of the example. + * + * @return string + */ + protected function getExampleName(): string { + return $this->exName; + } + public function __construct() { if (!preg_match(';^(.*)[_\\\]([a-zA-Z0-9]+)[_\\\]([a-zA-Z0-9]+)$;', static::class, $m)) { throw new \RuntimeException("Failed to parse class: " . static::class); diff --git a/Civi/Test/ExampleData/Contact/TheDailyBugle.php b/Civi/Test/ExampleData/Contact/TheDailyBugle.php new file mode 100644 index 0000000000..a4604c2f49 --- /dev/null +++ b/Civi/Test/ExampleData/Contact/TheDailyBugle.php @@ -0,0 +1,42 @@ + "entity/{$this->entityName}/" . $this->getExampleName(), + ]; + } + + public function build(array &$example): void { + $example['data'] = [ + 'contact_id' => 102, + 'contact_type' => 'Organization', + 'organization_name' => 'The Daily Bugle', + 'sort_name' => 'Daily Bugle', + 'display_name' => 'The Daily Bugle', + 'do_not_email' => 1, + 'do_not_phone' => 1, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, + 'is_opt_out' => 0, + 'legal_name' => 'The Daily Bugle', + 'sic_code' => NULL, + 'contact_is_deleted' => '0', + 'email_primary.email' => 'clark@example.com', + 'address_primary.street_address' => 'Goodman Building', + 'address_primary.supplemental_address' => 'Cnr 39th Street and Second Avenue', + 'address_primary.city' => 'New York', + 'email_greeting_id' => 1, + 'email_greeting_display' => 'Dear Bugle Reporters', + 'postal_greeting_id' => 1, + 'postal_greeting_display' => 'Dear Bugle Reporters', + ]; + } + +} -- 2.25.1