-
Notifications
You must be signed in to change notification settings - Fork 1
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
MAE-398: Make showing/hiding events "same email address?" setting configurable #21
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
106ec66
MAE-398: Change the way in which event fields are hidden
ahed-compucorp d461057
MAE-398: Fix missing default values for hidden event settings
ahed-compucorp 4e96f2c
MAE-398: Make 'same email address' default value configurable
ahed-compucorp 81014ac
MAE-398: Fix and add unit tests
ahed-compucorp 774675b
MAE-398: Update CiviCRM and specify Drupal version
ahed-compucorp 47c2904
MAE-398: Fix start date to be in the future for EventFabricator
ahed-compucorp 552f423
MAE-398: Fix linter errors
ahed-compucorp 258e38a
MAE-398: Remove unnecessary code because hiding the the whole parent …
ahed-compucorp 164dfcc
MAE-398: Rename hideElements method and update places where it is used
ahed-compucorp 5427d91
MAE-398: Create a new EventType in test instead of hard coding it
ahed-compucorp e21eae3
MAE-398: Fix a typo && remove unnecessary fields
ahed-compucorp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,63 @@ | ||
<?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::createEvenType(); | ||
$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 createEvenType() { | ||
$result = civicrm_api3('OptionValue', 'create', [ | ||
'option_group_id' => 'event_type', | ||
'name' => 'Conference', | ||
'label' => 'Conference', | ||
'weight' => 1, | ||
'is_active' => 1, | ||
'is_reserved' => 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no neeed for this to be reserved |
||
]); | ||
$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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo : createEvenType should be createEventType (missing T)