Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-21212 Include getUfId function for wordpress to help getting E2E … #11017

Merged
merged 1 commit into from
Oct 23, 2017

Conversation

seamuslee001
Copy link
Contributor

…unit tests running for wordpress


ping @totten

…unit tests running for wordpress

----------------------------------------
* CRM-21212: Get E2E Tests working on wordpress
  https://issues.civicrm.org/jira/browse/CRM-21212
@seamuslee001
Copy link
Contributor Author

also ping @kcristiano are you able to validate if this looks right to you?

@seamuslee001
Copy link
Contributor Author

@totten I think this will leave 1 E2E test that doesn't seem to be working for me locally but maybe environmental issues

* @return int|NULL
*/
public function getUfId($username) {
$userdata = get_user_by('login', $username);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 is there a reason you want to use get_user_by() as opposed to get_current_user_id() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kcristiano I saw its what is used in the function just above in L334, The purpose of this i think is that in the E2E tests we are passing through a user name + pw and authenticating then wanting to get the id back

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct - I was not thinking about the proper context. As we are running tests we need to pas in the user name = pw.

@seamuslee001
Copy link
Contributor Author

@totten I think given Kevin's comments i think this is good to merge

@totten
Copy link
Member

totten commented Oct 23, 2017

Thank you, @seamuslee001 @kcristiano. :)

For anyone reading this later, it may not be very clear what getUfId() is about. APIv3 has a feature where you can provide a username in lieu of a contact ID. Compare:

  • cv api contact.get id=123
  • cv api contact.get id=@user:demo

The feature relies on getUfId() -- which wasn't implemented on WordPress. #11017 adds getUfId(), which fixes the support for @user:<name>, which in turn makes the E2E suite more compatible with WordPress.

@totten totten merged commit 7c8d59c into civicrm:master Oct 23, 2017
@seamuslee001 seamuslee001 deleted the CRM-21212 branch October 24, 2017 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants