Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
9a42dcc8
Commit
9a42dcc8
authored
5 years ago
by
bgm
Committed by
bgm
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
#1280
Test for ContributionPage soft_credit translation
parent
54312ea9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Contribute/Form/ContributionPage/Settings.php
+1
-0
1 addition, 0 deletions
CRM/Contribute/Form/ContributionPage/Settings.php
tests/phpunit/CRM/Contribute/Form/ContributionPageTranslationTest.php
+94
-0
94 additions, 0 deletions
...t/CRM/Contribute/Form/ContributionPageTranslationTest.php
with
95 additions
and
0 deletions
CRM/Contribute/Form/ContributionPage/Settings.php
+
1
−
0
View file @
9a42dcc8
...
...
@@ -351,6 +351,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
// Look for an existing entry
$ufJoinDAO
=
new
CRM_Core_DAO_UFJoin
();
$ufJoinDAO
->
module
=
$ufJoinParam
[
'module'
];
$ufJoinDAO
->
entity_table
=
'civicrm_contribution_page'
;
$ufJoinDAO
->
entity_id
=
$ufJoinParam
[
'entity_id'
];
$ufJoinDAO
->
find
(
TRUE
);
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/CRM/Contribute/Form/ContributionPageTranslationTest.php
0 → 100644
+
94
−
0
View file @
9a42dcc8
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
* Test ContributionPage translation features.
*
* @group headless
*/
class
CRM_Contribute_Form_ContributionPageTranslationTest
extends
CiviUnitTestCase
{
public
function
setUp
()
{
parent
::
setUp
();
$this
->
_financialTypeID
=
1
;
$this
->
enableMultilingual
();
CRM_Core_I18n_Schema
::
addLocale
(
'fr_FR'
,
'en_US'
);
}
public
function
tearDown
()
{
global
$dbLocale
;
if
(
$dbLocale
)
{
CRM_Core_I18n_Schema
::
makeSinglelingual
(
'en_US'
);
}
}
/**
* Create() method (create Contribution Page with Honor block)
*/
public
function
testCreateHonor
()
{
CRM_Core_I18n
::
singleton
()
->
setLocale
(
'en_US'
);
$params
=
[
'title'
=>
'Test Contribution Page'
,
'financial_type_id'
=>
$this
->
_financialTypeID
,
'is_for_organization'
=>
0
,
'for_organization'
=>
' I am contributing on behalf of an organization'
,
'goal_amount'
=>
'400'
,
'is_active'
=>
1
,
'honor_block_is_active'
=>
1
,
'honor_block_title'
=>
'In Honor Title EN'
,
'honor_block_text'
=>
'In Honor Text EN'
,
// Honoree Individual
'honoree_profile'
=>
13
,
// In Honor Of
'soft_credit_types'
=>
1
,
'start_date'
=>
'20091022105900'
,
'start_date_time'
=>
'10:59AM'
,
'end_date'
=>
'19700101000000'
,
'end_date_time'
=>
''
,
'is_credit_card_only'
=>
''
,
];
$contributionpage
=
CRM_Contribute_BAO_ContributionPage
::
create
(
$params
);
// The BAO does not save these
$params
[
'id'
]
=
$contributionpage
->
id
;
$params
[
'honor_block_title'
]
=
'In Honor Title EN'
;
$params
[
'honor_block_text'
]
=
'In Honor Text EN'
;
$form
=
$this
->
getFormObject
(
'CRM_Contribute_Form_ContributionPage_Settings'
,
$params
,
'Settings'
);
$form
->
postProcess
();
// Now update the page with In Honor (soft credit) text in French
CRM_Core_I18n
::
singleton
()
->
setLocale
(
'fr_FR'
);
$params
[
'honor_block_title'
]
=
'In Honor Title FR'
;
$params
[
'honor_block_text'
]
=
'In Honor Text FR'
;
$form
=
$this
->
getFormObject
(
'CRM_Contribute_Form_ContributionPage_Settings'
,
$params
,
'Settings'
);
$form
->
postProcess
();
$uf
=
$this
->
callAPISuccess
(
'UFJoin'
,
'getsingle'
,
[
'entity_id'
=>
$contributionpage
->
id
,
'module'
=>
'soft_credit'
,
]);
$json
=
json_decode
(
$uf
[
'module_data'
],
TRUE
);
$this
->
assertEquals
(
'In Honor Title EN'
,
$json
[
'soft_credit'
][
'en_US'
][
'honor_block_title'
]);
$this
->
assertEquals
(
'In Honor Text EN'
,
$json
[
'soft_credit'
][
'en_US'
][
'honor_block_text'
]);
$this
->
assertEquals
(
'In Honor Title FR'
,
$json
[
'soft_credit'
][
'fr_FR'
][
'honor_block_title'
]);
$this
->
assertEquals
(
'In Honor Text FR'
,
$json
[
'soft_credit'
][
'fr_FR'
][
'honor_block_text'
]);
$this
->
callAPISuccess
(
'ContributionPage'
,
'delete'
,
[
'id'
=>
$contributionpage
->
id
]);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment