Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core now creates ufmatches on install, so trying to create it in test setup leads to fails #1004

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/src/FunctionalJavascript/MembershipSubmissionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ public function testSubmitWebform() {

$this->saveCiviCRMSettings();

$adminUserCid = $this->getUFMatchRecord($this->adminUser->id())['contact_id'];
// Create two memberships with the same status with the first membership
// having an end date after the second membership's end date.
$this->utils->wf_civicrm_api('membership', 'create', [
'membership_type_id' => 'Basic',
'contact_id' => 2,
'contact_id' => $adminUserCid,
'join_date' => '08/10/21',
'start_date' => '08/10/21',
'end_date' => '08/10/22',
Expand All @@ -136,7 +137,7 @@ public function testSubmitWebform() {

$this->utils->wf_civicrm_api('membership', 'create', [
'membership_type_id' => 'Basic',
'contact_id' => 2,
'contact_id' => $adminUserCid,
'join_date' => '01/01/21',
'start_date' => '01/01/21',
'end_date' => '01/01/22',
Expand Down
19 changes: 12 additions & 7 deletions tests/src/FunctionalJavascript/WebformCivicrmTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,18 @@ protected function setUp(): void {
'id' => 'civicrm_webform_test',
'title' => 'CiviCRM Webform Test.' . $CiviCRM_version,
]);
$this->rootUserCid = $this->createIndividual()['id'];
// Create CiviCRM contact for rootUser.
$this->utils->wf_civicrm_api('UFMatch', 'create', [
'uf_id' => $this->rootUser->id(),
'uf_name' => $this->rootUser->getAccountName(),
'contact_id' => $this->rootUserCid,
]);
if (version_compare(\CRM_Core_BAO_Domain::version(), '5.79.alpha1', '<')) {
$this->rootUserCid = $this->createIndividual()['id'];
// Create CiviCRM contact for rootUser.
$this->utils->wf_civicrm_api('UFMatch', 'create', [
'uf_id' => $this->rootUser->id(),
'uf_name' => $this->rootUser->getAccountName(),
'contact_id' => $this->rootUserCid,
]);
}
else {
$this->rootUserCid = $this->getUFMatchRecord($this->rootUser->id())['contact_id'];
}
}

protected function tearDown(): void {
Expand Down