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

Refactor and tests for user migration get user route #598

Merged
merged 1 commit into from
Dec 12, 2018

Conversation

joshcanhelp
Copy link
Contributor

@joshcanhelp joshcanhelp commented Dec 10, 2018

Changes

  • Refactor WP_Auth0_Routes::migration_ws_get_user() for more clear usage; add unit tests
  • Add private WP_Auth0_Routes::error_return_array() method to handle common failure returns
  • Minor unit test refactor for Routes

Testing

  • This change adds unit test coverage
  • This change has not been tested on 5.0.0; will test all functionality added in 3.9.0 at once.

Checklist

  • All existing and new tests complete without errors
  • All code quality tools/guidelines in the Contribution guide have been run/followed
  • All active GitHub CI checks have passed

@@ -89,27 +89,6 @@ public function tearDown() {
self::$error_log->clear();
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to tests/testRoutes.php

@@ -0,0 +1,258 @@
<?php
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very similar to tests in #595

@@ -0,0 +1,107 @@
<?php
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved from tests/testRoutesLogin.php

if ( ! $user ) {
$user = get_user_by( 'slug', $username );
}

if ( $user instanceof WP_Error ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A lot of unnecessary logic here ...

@joshcanhelp joshcanhelp added this to the 3.9.0 milestone Dec 10, 2018
@joshcanhelp joshcanhelp force-pushed the improve-migration-get-user-route branch from 9c8677a to 2147f70 Compare December 11, 2018 23:08
@codecov-io
Copy link

Codecov Report

Merging #598 into master will increase coverage by 0.89%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #598      +/-   ##
===========================================
+ Coverage      32.4%   33.3%   +0.89%     
- Complexity     1309    1312       +3     
===========================================
  Files            54      54              
  Lines          4187    4188       +1     
===========================================
+ Hits           1357    1395      +38     
+ Misses         2830    2793      -37
Impacted Files Coverage Δ Complexity Δ
lib/WP_Auth0_Routes.php 70.71% <100%> (+26.82%) 51 <3> (+3) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df34e2a...2147f70. Read the comment docs.

Copy link
Member

@cocojoe cocojoe left a comment

Choose a reason for hiding this comment

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

Looks good, sorry for time taken to review.

@joshcanhelp joshcanhelp merged commit 6701aee into master Dec 12, 2018
@joshcanhelp joshcanhelp deleted the improve-migration-get-user-route branch December 12, 2018 20:16
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants