-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from compucorp/MAE-398-events-extras-hide-setting
MAE-398: Make showing/hiding events "same email address?" setting configurable
- Loading branch information
Showing
16 changed files
with
338 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,14 +29,14 @@ jobs: | |
run : amp config:set --mysql_dsn=mysql://root:root@mysql:3306 | ||
|
||
- name: Build Drupal site | ||
run: civibuild create drupal-clean --civi-ver 5.24.6 --web-root $GITHUB_WORKSPACE/site | ||
run: civibuild create drupal-clean --civi-ver 5.28.3 --cms-ver 7.75 --web-root $GITHUB_WORKSPACE/site | ||
|
||
- uses: compucorp/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
repo: compucorp/civicrm-core | ||
version: 5.24.6 | ||
version: 5.28.3 | ||
path: site/web/sites/all/modules/civicrm | ||
|
||
- uses: actions/checkout@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* Class CRM_EventsExtras_Test_Fabricator_Base. | ||
*/ | ||
abstract class CRM_EventsExtras_Test_Fabricator_Base { | ||
|
||
/** | ||
* Name of the entity to be fabricated. | ||
* | ||
* @var string | ||
*/ | ||
protected static $entityName; | ||
|
||
/** | ||
* List of default parameters to use on fabrication of entities. | ||
* | ||
* @var array | ||
*/ | ||
protected static $defaultParams = []; | ||
|
||
/** | ||
* Fabricates an instance of the entity with the given parameters. | ||
* | ||
* @param array $params | ||
* | ||
* @return mixed | ||
* @throws \CiviCRM_API3_Exception | ||
* @throws \Exception | ||
*/ | ||
public static function fabricate(array $params = []) { | ||
if (empty(static::$entityName)) { | ||
throw new \Exception('Entity name cannot be empty!'); | ||
} | ||
|
||
$params = array_merge(static::$defaultParams, $params); | ||
$result = civicrm_api3(static::$entityName, 'create', $params); | ||
|
||
return array_shift($result['values']); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
use CRM_EventsExtras_Test_Fabricator_Base as BaseFabricator; | ||
|
||
/** | ||
* Class CRM_EventsExtras_Test_Fabricator_Event. | ||
*/ | ||
class CRM_EventsExtras_Test_Fabricator_Event extends BaseFabricator { | ||
|
||
/** | ||
* Entity's name. | ||
* | ||
* @var string | ||
*/ | ||
protected static $entityName = 'Event'; | ||
|
||
/** | ||
* Array if default parameters to be used to create an event. | ||
* | ||
* @var array | ||
*/ | ||
protected static $defaultParams = [ | ||
'title' => 'Event Sample' , | ||
]; | ||
|
||
/** | ||
* Fabricates an event with the given parameters. | ||
* | ||
* @param array $params | ||
* | ||
* @return array | ||
* @throws \CiviCRM_API3_Exception | ||
*/ | ||
public static function fabricate(array $params = []) { | ||
$startDate = new DateTime(); | ||
|
||
$eventType = self::createEventType(); | ||
$eventTypeId = $eventType['value']; | ||
|
||
$defaultParams = array_merge(static::$defaultParams, [ | ||
'start_date' => $startDate->format('Ymd'), | ||
'event_type_id' => $eventTypeId, | ||
]); | ||
|
||
$params = array_merge($defaultParams, $params); | ||
|
||
return parent::fabricate($params); | ||
} | ||
|
||
private static function createEventType() { | ||
$result = civicrm_api3('OptionValue', 'create', [ | ||
'option_group_id' => 'event_type', | ||
'name' => 'Conference', | ||
]); | ||
$eventType = array_shift($result['values']); | ||
|
||
return $eventType; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.