Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
justinfreeman (Agileware)
Core
Commits
43ef1263
Commit
43ef1263
authored
11 years ago
by
Eileen McNaughton
Browse files
Options
Downloads
Patches
Plain Diff
Additional test on return.address_name
parent
dd9d7b83
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/phpunit/api/v3/ContactTest.php
+25
-20
25 additions, 20 deletions
tests/phpunit/api/v3/ContactTest.php
with
25 additions
and
20 deletions
tests/phpunit/api/v3/ContactTest.php
+
25
−
20
View file @
43ef1263
...
...
@@ -578,11 +578,23 @@ class api_v3_ContactTest extends CiviUnitTestCase {
$params
=
array
(
'return'
=>
'custom_'
.
$ids
[
'custom_field_id'
],
'id'
=>
$result
[
'id'
]);
$check
=
$this
->
callAPIAndDocument
(
$this
->
_entity
,
'get'
,
$params
,
__FUNCTION__
,
__FILE__
,
$description
,
$subfile
);
$this
->
assertEquals
(
"custom string"
,
$check
[
'values'
][
$check
[
'id'
]][
'custom_'
.
$ids
[
'custom_field_id'
]]
,
' in line '
.
__LINE__
);
$this
->
assertEquals
(
"custom string"
,
$check
[
'values'
][
$check
[
'id'
]][
'custom_'
.
$ids
[
'custom_field_id'
]]);
$this
->
customFieldDelete
(
$ids
[
'custom_field_id'
]);
$this
->
customGroupDelete
(
$ids
[
'custom_group_id'
]);
}
/**
* Check that address name is returned if required
*/
function
testGetReturnAddressName
()
{
$contactID
=
$this
->
individualCreate
();
$this
->
callAPISuccess
(
'address'
,
'create'
,
array
(
'contact_id'
=>
$contactID
,
'address_name'
=>
'My house'
,
'location_type_id'
=>
'Home'
,
'street_address'
=>
'1 my road'
));
$result
=
$this
->
callAPISuccessGetSingle
(
'contact'
,
array
(
'return'
=>
'address_name, street_address'
,
'id'
=>
$contactID
));
$this
->
assertEquals
(
'1 my road'
,
$result
[
'street_address'
]);
$this
->
assertEquals
(
'My house'
,
$result
[
'address_name'
]);
}
function
testGetGroupIDFromContact
()
{
$groupId
=
$this
->
groupCreate
(
NULL
);
$description
=
"Get all from group and display contacts"
;
...
...
@@ -883,7 +895,7 @@ class api_v3_ContactTest extends CiviUnitTestCase {
'home_url'
=>
'http://www.example.org'
,
);
$getResult
=
$this
->
callAPISuccess
(
'Contact'
,
'Get'
,
array
());
$result
=
$this
->
callAPISuccess
(
'Contact'
,
'Update'
,
$params
);
$getResult
=
$this
->
callAPISuccess
(
'Contact'
,
'Get'
,
$params
);
unset
(
$params
[
'contact_id'
]);
...
...
@@ -958,15 +970,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
$result
=
$this
->
callAPISuccess
(
'Contact'
,
'Update'
,
$params
);
// Check updated civicrm_contact against expected
$expected
=
new
PHPUnit_Extensions_Database_DataSet_XMLDataSet
(
dirname
(
__FILE__
)
.
'/dataset/contact_hld_upd.xml'
);
$actual
=
new
PHPUnit_Extensions_Database_DataSet_QueryDataset
(
$this
->
_dbconn
$expected
=
array
(
'contact_type'
=>
'Household'
,
'is_opt_out'
=>
0
,
'sort_name'
=>
'ABC household'
,
'display_name'
=>
'ABC household'
,
'nick_name'
=>
'ABC House'
,
);
$actual
->
addTable
(
'civicrm_contact'
);
$expected
->
matches
(
$actual
);
$this
->
getAndCheck
(
$expected
,
$result
[
'id'
],
'contact'
);
}
/**
...
...
@@ -1086,20 +1097,14 @@ class api_v3_ContactTest extends CiviUnitTestCase {
* Test civicrm_contact_get() with default return properties
*/
public
function
testContactGetRetDefault
()
{
// Insert a row in civicrm_contact creating contact 17
$op
=
new
PHPUnit_Extensions_Database_Operation_Insert
();
$op
->
execute
(
$this
->
_dbconn
,
new
PHPUnit_Extensions_Database_DataSet_XMLDataSet
(
dirname
(
__FILE__
)
.
'/dataset/contact_17.xml'
)
);
$contactID
=
$this
->
individualCreate
();
$params
=
array
(
'contact_id'
=>
17
,
'contact_id'
=>
$contactID
,
'sort'
=>
'first_name'
,
);
$result
=
$this
->
callAPISuccess
(
'contact'
,
'get'
,
$params
);
$this
->
assertEquals
(
17
,
$result
[
'values'
][
17
][
'contact_id'
]
,
"In line "
.
__LINE__
);
$this
->
assertEquals
(
'
Test
'
,
$result
[
'values'
][
17
][
'first_name'
]
,
"In line "
.
__LINE__
);
$this
->
assertEquals
(
$contactID
,
$result
[
'values'
][
$contactID
][
'contact_id'
]);
$this
->
assertEquals
(
'
Anthony
'
,
$result
[
'values'
][
$contactID
][
'first_name'
]);
}
/**
...
...
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