Skip to content

Commit

Permalink
Remove dbunit dependency from mailing data
Browse files Browse the repository at this point in the history
  • Loading branch information
eileen committed May 21, 2019
1 parent 24aa731 commit c216e73
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 256 deletions.
6 changes: 3 additions & 3 deletions tests/phpunit/CRM/Contact/BAO/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function tearDown() {
* @param $full
*/
public function testSearch($fv, $count, $ids, $full) {
$this->callAPISuccess('SavedSearch', 'create', ['form_values' => 'a:9:{s:5:"qfKey";s:32:"0123456789abcdef0123456789abcdef";s:13:"includeGroups";a:1:{i:0;s:1:"3";}s:13:"excludeGroups";a:0:{}s:11:"includeTags";a:0:{}s:11:"excludeTags";a:0:{}s:4:"task";s:2:"14";s:8:"radio_ts";s:6:"ts_all";s:14:"customSearchID";s:1:"4";s:17:"customSearchClass";s:36:"CRM_Contact_Form_Search_Custom_Group";}',]);
$this->callAPISuccess('SavedSearch', 'create', ['form_values' => 'a:9:{s:5:"qfKey";s:32:"0123456789abcdef0123456789abcdef";s:13:"includeGroups";a:1:{i:0;s:1:"3";}s:13:"excludeGroups";a:0:{}s:11:"includeTags";a:0:{}s:11:"excludeTags";a:0:{}s:4:"task";s:2:"14";s:8:"radio_ts";s:6:"ts_all";s:14:"customSearchID";s:1:"4";s:17:"customSearchClass";s:36:"CRM_Contact_Form_Search_Custom_Group";}',]);
$this->callAPISuccess('SavedSearch', 'create', ['form_values' => 'a:9:{s:5:"qfKey";s:32:"0123456789abcdef0123456789abcdef";s:13:"includeGroups";a:1:{i:0;s:1:"3";}s:13:"excludeGroups";a:0:{}s:11:"includeTags";a:0:{}s:11:"excludeTags";a:0:{}s:4:"task";s:2:"14";s:8:"radio_ts";s:6:"ts_all";s:14:"customSearchID";s:1:"4";s:17:"customSearchClass";s:36:"CRM_Contact_Form_Search_Custom_Group";}']);
$this->callAPISuccess('SavedSearch', 'create', ['form_values' => 'a:9:{s:5:"qfKey";s:32:"0123456789abcdef0123456789abcdef";s:13:"includeGroups";a:1:{i:0;s:1:"3";}s:13:"excludeGroups";a:0:{}s:11:"includeTags";a:0:{}s:11:"excludeTags";a:0:{}s:4:"task";s:2:"14";s:8:"radio_ts";s:6:"ts_all";s:14:"customSearchID";s:1:"4";s:17:"customSearchClass";s:36:"CRM_Contact_Form_Search_Custom_Group";}']);

$tag7 = $this->ids['Tag'][7] = $this->tagCreate(['name' => 'Test Tag 7', 'description' => 'Test Tag 7'])['id'];
$tag9 = $this->ids['Tag'][9] = $this->tagCreate(['name' => 'Test Tag 9', 'description' => 'Test Tag 9'])['id'];
Expand All @@ -67,7 +67,7 @@ public function testSearch($fv, $count, $ids, $full) {
}
$individuals = [
['first_name' => 'Test', 'last_name' => 'Test Contact 9', 'gender_id' => 1, 'prefix_id' => 1, 'suffix_id' => 1],
['first_name' => 'Test', 'last_name' => 'Test Contact 10', 'gender_id' => 2, 'prefix_id' => 2, 'suffix_id' => 2, 'api.entity_tag.create' => ['tag_id' => $tag9],],
['first_name' => 'Test', 'last_name' => 'Test Contact 10', 'gender_id' => 2, 'prefix_id' => 2, 'suffix_id' => 2, 'api.entity_tag.create' => ['tag_id' => $tag9]],
['first_name' => 'Test', 'last_name' => 'Test Contact 11', 'gender_id' => 3, 'prefix_id' => 3, 'suffix_id' => 3, 'api.entity_tag.create' => ['tag_id' => $tag7]],
['first_name' => 'Test', 'last_name' => 'Test Contact 12', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 4, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]],
['first_name' => 'Test', 'last_name' => 'Test Contact 13', 'gender_id' => 2, 'prefix_id' => 2, 'suffix_id' => 2],
Expand Down
23 changes: 5 additions & 18 deletions tests/phpunit/CRM/Mailing/BAO/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
class CRM_Mailing_BAO_QueryTest extends CiviUnitTestCase {

use CRMTraits_Mailing_MailingTrait;

/**
* @return CRM_Mailing_BAO_QueryTestDataProvider
*/
Expand Down Expand Up @@ -44,12 +46,7 @@ public function tearDown() {
* @param $full
*/
public function testSearch($fv, $count, $ids, $full) {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
dirname(__FILE__) . '/queryDataset.xml'
)
);
$this->loadMailingDeliveryDataSet();

$params = CRM_Contact_BAO_Query::convertFormValues($fv);
$obj = new CRM_Contact_BAO_Query($params);
Expand All @@ -73,12 +70,7 @@ public function testSearch($fv, $count, $ids, $full) {
* CRM-20412: Test accurate count for unique open details
*/
public function testOpenedMailingQuery() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
dirname(__FILE__) . '/queryDataset.xml'
)
);
$this->loadMailingDeliveryDataSet();

// ensure that total unique opened mail count is same while
// fetching rows and row count for mailing_id = 14
Expand All @@ -93,12 +85,7 @@ public function testOpenedMailingQuery() {
* CRM-21194: Test accurate count for unique trackable URLs
*/
public function testTrackableUrlMailingQuery() {
$op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute($this->_dbconn,
$this->createFlatXMLDataSet(
dirname(__FILE__) . '/queryDataset.xml'
)
);
$this->loadMailingDeliveryDataSet();

// ensure that total unique clicked mail count is same while
// fetching rows and row count for mailing_id = 14 and
Expand Down
Loading

0 comments on commit c216e73

Please sign in to comment.