loadDataSet('CaseType'); } public function tearDown(): void { $relatedTables = [ 'civicrm_activity', 'civicrm_activity_contact', 'civicrm_relationship', 'civicrm_case_contact', 'civicrm_case_type', 'civicrm_case', ]; $this->cleanup(['tablesToTruncate' => $relatedTables]); parent::tearDown(); } public function testCreateUsingLoggedInUser() { $uid = $this->createLoggedInUser(); $contactID = $this->createEntity(['type' => 'Individual'])['id']; $case = CiviCase::create(FALSE) ->addValue('case_type_id', $this->getReference('test_case_type_1')['id']) ->addValue('creator_id', 'user_contact_id') ->addValue('status_id', 1) ->addValue('contact_id', $contactID) ->execute() ->first(); $relationships = Relationship::get(FALSE) ->addWhere('case_id', '=', $case['id']) ->execute(); $this->assertCount(1, $relationships); $this->assertEquals($uid, $relationships[0]['contact_id_b']); $this->assertEquals($contactID, $relationships[0]['contact_id_a']); } }