Skip to content

Commit

Permalink
COMCL-670: Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Shahrukh committed Aug 9, 2024
1 parent 9587798 commit 587e861
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ jobs:
- name: Run phpunit tests
if: ${{ always() }}
working-directory: ${{ env.CIVICRM_EXTENSIONS_DIR }}/uk.co.compucorp.certificate
run: phpunit5
run: phpunit8
10 changes: 9 additions & 1 deletion CRM/Certificate/Token/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ public function __construct($tokenNames = []) {
*/
public static function entityTokens() {
$membershipCustomFields = CRM_Utils_Token::getCustomFieldTokens('Membership');
$membershipTokens = CRM_Core_SelectValues::membershipTokens();
$membershipTokens = [
'{membership.id}' => ts('Membership ID'),
'{membership.status_id:label}' => ts('Status'),
'{membership.membership_type_id:label}' => ts('Membership Type'),
'{membership.start_date}' => ts('Membership Start Date'),
'{membership.join_date}' => ts('Member Since'),
'{membership.end_date}' => ts('Membership Expiration Date'),
'{membership.fee}' => ts('Membership Fee'),
];
$extraTokens = [
'source' => ts('Membership Source'),
'membership_name' => ts('Membership Name'),
Expand Down
3 changes: 2 additions & 1 deletion tests/phpunit/BaseHeadlessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Civi\Test;
use Civi\Test\HeadlessInterface;
use Civi\Test\TransactionalInterface;
use PHPUnit\Framework\MockObject\MockBuilder;

/**
* Base test class.
Expand All @@ -24,7 +25,7 @@ public function setUpHeadless() {
/**
* {@inheritDoc}
*/
public function getMockBuilder($className) {
public function getMockBuilder($className): MockBuilder {
$mockBuilder = (new class($this, $className) extends PHPUnit_Framework_MockObject_MockBuilder {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class api_v3_CompuCertificate_GetcontactcertificatesTest extends BaseHeadlessTes
*/
private $client_id;

public function setUp() {
public function setUp(): void {
parent::setUp();
$contact = ContactFabricator::fabricate();
$this->registerCurrentLoggedInContactInSession($contact['id']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class api_v3_CompuCertificate_GetrelatedcontactcertificatesTest extends BaseHead
*/
private $client_id;

public function setUp() {
public function setUp(): void {
parent::setUp();
$contact = ContactFabricator::fabricate();
$this->registerCurrentLoggedInContactInSession($contact['id']);
Expand Down

0 comments on commit 587e861

Please sign in to comment.