Skip to content

Commit

Permalink
MMB-270: Add min and max dates to test fabricators
Browse files Browse the repository at this point in the history
  • Loading branch information
shahrukh-moby committed Nov 2, 2023
1 parent 4fc1c9e commit 23e32fb
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CRM/Certificate/Test/Fabricator/CompuCertificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public static function getDefaultParams() {
'downolad_format' => DownloadFormat::IMAGE,
'start_date' => date("Y-m-d"),
'end_date' => date("Y-m-d", strtotime(date("Y-m-d") . " + 10 days")),
'min_valid_from_date' => date("Y-m-d"),
'max_valid_through_date' => date("Y-m-d", strtotime(date("Y-m-d") . " + 30 days")),
'relationship_types' => [],
];
}
Expand Down
2 changes: 2 additions & 0 deletions CRM/Certificate/Test/Fabricator/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public static function getDefaultParams() {
return [
'title' => md5(mt_rand()),
'start_date' => date('Y-m-d'),
'min_valid_from_date' => date("Y-m-d"),
'max_valid_through_date' => date("Y-m-d", strtotime(date("Y-m-d") . " + 30 days")),
'event_type_id' => 1,
'summary' => md5(mt_rand()),
'description' => md5(mt_rand()),
Expand Down
2 changes: 2 additions & 0 deletions CRM/Certificate/Test/Fabricator/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class CRM_Certificate_Test_Fabricator_Membership {
'join_date' => '2006-01-21',
'start_date' => '2006-01-21',
'end_date' => '2006-12-21',
'min_valid_from_date' => '2006-02-01',
'max_valid_through_date' => '2006-06-05',
'source' => 'Payment',
'is_override' => 1,
];
Expand Down
2 changes: 2 additions & 0 deletions CRM/Certificate/Test/Fabricator/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class CRM_Certificate_Test_Fabricator_Relationship {
'is_active' => 1,
'start_date' => NULL,
'end_date' => NULL,
'min_valid_from_date' => NULL,
'max_valid_through_date' => NULL,
];

public static function fabricate($params = []) {
Expand Down
2 changes: 2 additions & 0 deletions CRM/Certificate/Test/Helper/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ private function createCaseCertificate($params = []) {
'linked_to' => [$caseType['id']],
'statuses' => [$caseStatus['value']],
'start_date' => $params['start_date'] ?? date('Y-m-d'),
'min_valid_from_date' => $params['min_valid_from_date'] ?? date("Y-m-d"),
'max_valid_through_date' => $params['max_valid_through_date'] ?? date("Y-m-d", strtotime(date("Y-m-d") . " + 30 days")),
'relationship_types' => $params['relationship_types'] ?? [],
'end_date' => $params['end_date'] ?? date('Y-m-d', strtotime(date('Y-m-d') . " 10 days")),
];
Expand Down
2 changes: 2 additions & 0 deletions CRM/Certificate/Test/Helper/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ private function createEventCertificate($params = []) {
'start_date' => date('Y-m-d'),
'relationship_types' => $params['relationship_types'] ?? [],
'end_date' => date('Y-m-d', strtotime(date('Y-m-d') . " 10 days")),
'min_valid_from_date' => date("Y-m-d"),
'max_valid_through_date' => date("Y-m-d", strtotime(date("Y-m-d") . " + 30 days")),
], $params);

return CompuCertificateFabricator::fabricate(CertificateType::EVENTS, $values);
Expand Down
2 changes: 2 additions & 0 deletions CRM/Certificate/Test/Helper/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ private function createMembershipCertificate($params = []) {
'start_date' => date('Y-m-d'),
'relationship_types' => $params['relationship_types'] ?? [],
'end_date' => date('Y-m-d', strtotime(date('Y-m-d') . " 10 days")),
'min_valid_from_date' => date("Y-m-d"),
'max_valid_through_date' => date("Y-m-d", strtotime(date("Y-m-d") . " + 30 days")),
], $params);

return CompuCertificateFabricator::fabricate(CertificateType::MEMBERSHIPS, $values);
Expand Down

0 comments on commit 23e32fb

Please sign in to comment.