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
04ee2e0e
Commit
04ee2e0e
authored
11 years ago
by
eileen
Browse files
Options
Downloads
Patches
Plain Diff
CRM-13142 , CRM-13067 update tests to date setting is tested correctly
parent
84e91e72
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
tests/phpunit/CRM/Batch/Form/EntryTest.php
+57
-5
57 additions, 5 deletions
tests/phpunit/CRM/Batch/Form/EntryTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
+4
-5
4 additions, 5 deletions
tests/phpunit/CiviTest/CiviUnitTestCase.php
with
61 additions
and
10 deletions
tests/phpunit/CRM/Batch/Form/EntryTest.php
+
57
−
5
View file @
04ee2e0e
...
...
@@ -57,6 +57,19 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
* @var String
*/
protected
$_contactID2
=
NULL
;
/**
* Contact id used in test function
* @var String
*/
protected
$_contactID3
=
NULL
;
/**
* Contact id used in test function
* @var String
*/
protected
$_contactID4
=
NULL
;
/**
* Describe test class
* @return array
...
...
@@ -112,6 +125,9 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
'contact_type'
=>
'Individual'
,
);
$this
->
_contactID2
=
$this
->
individualCreate
(
$contact2Params
);
$this
->
_contactID3
=
$this
->
individualCreate
(
array
(
'first_name'
=>
'bobby'
,
'email'
=>
'c@d.com'
));
$this
->
_contactID4
=
$this
->
individualCreate
(
array
(
'first_name'
=>
'bobbynita'
,
'email'
=>
'c@de.com'
));
$session
=
CRM_Core_Session
::
singleton
();
$session
->
set
(
'dateTypes'
,
1
);
...
...
@@ -141,7 +157,22 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
$params
=
$this
->
getMembershipData
();
$this
->
assertTrue
(
$form
->
testProcessMembership
(
$params
));
$result
=
$this
->
callAPISuccess
(
'membership'
,
'get'
,
array
());
$this
->
assertEquals
(
2
,
$result
[
'count'
]);
$this
->
assertEquals
(
3
,
$result
[
'count'
]);
//check start dates #1 should default to 1 Jan this year, #2 should be as entered
$this
->
assertEquals
(
date
(
'Y-m-d'
,
strtotime
(
'first day of January this year'
)),
$result
[
'values'
][
1
][
'start_date'
]);
$this
->
assertEquals
(
'2013-02-03'
,
$result
[
'values'
][
2
][
'start_date'
]);
//check start dates #1 should default to 1 Jan this year, #2 should be as entered
$this
->
assertEquals
(
date
(
'Y-m-d'
,
strtotime
(
'last day of December this year'
)),
$result
[
'values'
][
1
][
'end_date'
]);
$this
->
assertEquals
(
date
(
'Y-m-d'
,
strtotime
(
'last day of December this year'
)),
$result
[
'values'
][
2
][
'end_date'
]);
$this
->
assertEquals
(
'2013-12-01'
,
$result
[
'values'
][
3
][
'end_date'
]);
//check start dates #1 should default to 1 Jan this year, #2 should be as entered
$this
->
assertEquals
(
date
(
'Y-m-d'
,
strtotime
(
'07/22/2013'
)),
$result
[
'values'
][
1
][
'join_date'
]);
$this
->
assertEquals
(
date
(
'Y-m-d'
,
strtotime
(
'07/03/2013'
)),
$result
[
'values'
][
2
][
'join_date'
]);
$this
->
assertEquals
(
date
(
'Y-m-d'
,
strtotime
(
'now'
)),
$result
[
'values'
][
3
][
'join_date'
]);
}
/*
...
...
@@ -156,8 +187,12 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
*/
return
array
(
'batch_id'
=>
4
,
'primary_profiles'
=>
array
(
1
=>
NULL
,
2
=>
NULL
),
'primary_contact_select_id'
=>
Array
(
1
=>
$this
->
_contactID
,
2
=>
$this
->
_contactID2
),
'primary_profiles'
=>
array
(
1
=>
NULL
,
2
=>
NULL
,
3
=>
NULL
),
'primary_contact_select_id'
=>
Array
(
1
=>
$this
->
_contactID
,
2
=>
$this
->
_contactID2
,
3
=>
$this
->
_contactID3
,
),
'field'
=>
array
(
1
=>
array
(
'membership_type'
=>
Array
(
0
=>
1
,
1
=>
1
),
// (I was unable to determine what these both mean but both are refered to in code
...
...
@@ -176,7 +211,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
2
=>
array
(
'membership_type'
=>
Array
(
0
=>
1
,
1
=>
1
),
'join_date'
=>
'07/03/2013'
,
'membership_start_date'
=>
NULL
,
'membership_start_date'
=>
'02/03/2013'
,
'membership_end_date'
=>
NULL
,
'membership_source'
=>
NULL
,
'financial_type'
=>
2
,
...
...
@@ -186,9 +221,26 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
'payment_instrument'
=>
NULL
,
'check_number'
=>
NULL
,
'contribution_status_id'
=>
1
,
)
),
// no join date, coded end date
3
=>
array
(
'membership_type'
=>
Array
(
0
=>
1
,
1
=>
1
),
'join_date'
=>
NULL
,
'membership_start_date'
=>
NULL
,
'membership_end_date'
=>
'2013-12-01'
,
'membership_source'
=>
NULL
,
'financial_type'
=>
2
,
'total_amount'
=>
1
,
'receive_date'
=>
'07/17/2013'
,
'receive_date_time'
=>
NULL
,
'payment_instrument'
=>
NULL
,
'check_number'
=>
NULL
,
'contribution_status_id'
=>
1
,
),
),
'actualBatchTotal'
=>
0
,
);
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/CiviTest/CiviUnitTestCase.php
+
4
−
5
View file @
04ee2e0e
...
...
@@ -866,9 +866,8 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
*
* @return int id of Individual created
*/
function
individualCreate
(
$params
=
NULL
)
{
if
(
$params
===
NULL
)
{
$params
=
array
(
function
individualCreate
(
$params
=
array
())
{
$params
=
array_merge
(
array
(
'first_name'
=>
'Anthony'
,
'middle_name'
=>
'J.'
,
'last_name'
=>
'Anderson'
,
...
...
@@ -876,8 +875,8 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
'suffix_id'
=>
3
,
'email'
=>
'anthony_anderson@civicrm.org'
,
'contact_type'
=>
'Individual'
,
);
}
),
$params
);
return
$this
->
_contactCreate
(
$params
);
}
...
...
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