Skip to content

Commit

Permalink
Merge pull request #25372 from braders/dynamic-properties-contributio…
Browse files Browse the repository at this point in the history
…n-page-test

[REF][PHP8.2] Use const instead of dynamic property: CRM_Contribute_BAO_ContributionPageTest
  • Loading branch information
totten authored Jan 18, 2023
2 parents f0bc697 + e994c00 commit 1073951
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
*/
class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {

const FINANCIAL_TYPE_ID = 1;

public function setUp(): void {
parent::setUp();
$this->_financialTypeID = 1;
}

/**
Expand All @@ -28,7 +29,7 @@ public function testCreate() {
$params = [
'qfkey' => '9a3ef3c08879ad4c8c109b21c583400e',
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_financialTypeID,
'financial_type_id' => self::FINANCIAL_TYPE_ID,
'intro_text' => '',
'footer_text' => 'Thanks',
'is_for_organization' => 0,
Expand Down Expand Up @@ -58,7 +59,7 @@ public function testsetIsActive() {

$params = [
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_financialTypeID,
'financial_type_id' => self::FINANCIAL_TYPE_ID,
'is_active' => 1,
];

Expand All @@ -77,7 +78,7 @@ public function testSetValues() {

$params = [
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_financialTypeID,
'financial_type_id' => self::FINANCIAL_TYPE_ID,
'is_active' => 1,
];

Expand All @@ -88,7 +89,7 @@ public function testSetValues() {
CRM_Contribute_BAO_ContributionPage::setValues($id, $values);

$this->assertEquals($params['title'], $values['title'], 'Verify contribution title.');
$this->assertEquals($this->_financialTypeID, $values['financial_type_id'], 'Verify financial types id.');
$this->assertEquals(self::FINANCIAL_TYPE_ID, $values['financial_type_id'], 'Verify financial types id.');
$this->assertEquals(1, $values['is_active'], 'Verify contribution is_active value.');
$this->callAPISuccess('ContributionPage', 'delete', ['id' => $contributionPage->id]);
}
Expand All @@ -100,7 +101,7 @@ public function testcopy() {
$params = [
'qfkey' => '9a3ef3c08879ad4c8c109b21c583400e',
'title' => 'Test Contribution Page',
'financial_type_id' => $this->_financialTypeID,
'financial_type_id' => self::FINANCIAL_TYPE_ID,
'intro_text' => '',
'footer_text' => 'Thanks',
'is_for_organization' => 0,
Expand All @@ -118,7 +119,7 @@ public function testcopy() {

$contributionPage = CRM_Contribute_BAO_ContributionPage::create($params);
$copyContributionPage = CRM_Contribute_BAO_ContributionPage::copy($contributionPage->id);
$this->assertEquals($copyContributionPage->financial_type_id, $this->_financialTypeID, 'Check for Financial type id.');
$this->assertEquals($copyContributionPage->financial_type_id, self::FINANCIAL_TYPE_ID, 'Check for Financial type id.');
$this->assertEquals($copyContributionPage->goal_amount, 400, 'Check for goal amount.');
$this->callAPISuccess('ContributionPage', 'delete', ['id' => $contributionPage->id]);
$this->callAPISuccess('ContributionPage', 'delete', ['id' => $copyContributionPage->id]);
Expand Down

0 comments on commit 1073951

Please sign in to comment.