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

Testing: implement automated tests + write manual functional test instructions #55

Closed
helen opened this issue Sep 6, 2018 · 5 comments · Fixed by #155 or #132
Closed

Testing: implement automated tests + write manual functional test instructions #55

helen opened this issue Sep 6, 2018 · 5 comments · Fixed by #155 or #132
Assignees
Labels
type:enhancement New feature or request. type:good-first-issue Good for newcomers.
Milestone

Comments

@helen
Copy link
Contributor

helen commented Sep 6, 2018

Popular plugin that is supposed to help you with site privacy with an array of options - very important we test all situations and ensure they continue to work as expected through changes in the plugin and WordPress core, both in an automated fashion and manually during release prep.

I am not sure that automated tests can be thorough without actually bootstrapping WordPress, i.e. I'm not sure WP_Mock will be good enough to catch things like #53 proactively. If it is, that's great! But my sense is that integration tests will be just as, if not more, important as unit tests, because if core changes the way redirects or query var filling works, we can't mock that.

Here's what needs to be tested (we can turn this into a proper matrix at some point), please feel free to note anything I've neglected:

RSA technical features

  • Redirect to login
  • Redirect to URL
  • Redirect to page (see page types below)
  • Show a message
  • IP whitelisting (option and config-set)
  • Network-enforced settings (multisite)
  • WP CLI integration
    • List
    • Add (existing, new, invalid)
    • Remove (existing, non-existing, config-set, invalid)
    • Various flags

WordPress features

  • Single site
  • Multisite
  • User with no role on site (multisite)
  • Different page types, to and from (page on front, page for posts, BuddyPress-style virtual pages, regular pages)

RSA UI features

  • Settings
    • IP add/remove
    • Config-set IPs
    • Page selection
    • Radio selection
    • Multisite
  • Simple message display (especially with different HTML tags)
@petenelson
Copy link
Contributor

I can take a stab at this. I've been doing a lot more unit testing recently.

@petenelson
Copy link
Contributor

While working on this, I found a bug in the code that checks to see if we're on the existing page. If there isn't a permalink structure set, it gets caught in a redirect loop. I'll address this as part of the pull request.

// Are we already on the selected page?
// There's a separate unpleasant conditional to match the page on front because of the way query vars are (not) filled at this point
if (
	( isset( $wp->query_vars['pagename'] ) && $wp->query_vars['pagename'] === $page->post_name )
	||
	( empty ( $wp->query_vars ) && 'page' === get_option( 'show_on_front' ) && (int) self::$rsa_options['page'] === (int) get_option( 'page_on_front' ) )
	) {
	return;
}

@petenelson
Copy link
Contributor

I have about 48% code coverage so far and automated tests running here: https://travis-ci.org/petenelson/restricted-site-access

This branch has all of the new unit tests code and is still a work-in-progress. I'll get a PR opened for this once it's closer to full code coverage.

@jeffpaul jeffpaul added this to the 7.1.0 milestone Feb 6, 2019
@helen helen removed this from the 7.1.0 milestone Apr 11, 2019
@helen
Copy link
Contributor Author

helen commented Apr 11, 2019

Punting this out of 7.1.0 because it's not really tied to a milestone and I want to continue using it as an umbrella for implementing WP Acceptance tests and hopefully reducing the fragile HTML-based tests.

@helen
Copy link
Contributor Author

helen commented Apr 11, 2019

Also a note that Gruntfile.js references a phpunit-boostrap.php that doesn't seem to exist anymore.

@jeffpaul jeffpaul added this to the 7.2.0 milestone Apr 11, 2019
@helen helen removed this from the 7.2.0 milestone Nov 21, 2019
@jeffpaul jeffpaul added this to the 7.3.0 milestone Dec 2, 2019
@jeffpaul jeffpaul linked a pull request Oct 5, 2021 that will close this issue
8 tasks
@jeffpaul jeffpaul moved this to In Progress in Open Source Practice Oct 12, 2021
@jeffpaul jeffpaul moved this from In Progress to To Do in Open Source Practice Oct 12, 2021
@jeffpaul jeffpaul moved this from To Do to In Progress in Open Source Practice Oct 12, 2021
@jeffpaul jeffpaul linked a pull request Oct 12, 2021 that will close this issue
6 tasks
Repository owner moved this from In Progress to Merged in Open Source Practice Oct 27, 2021
@jeffpaul jeffpaul moved this from Merged to Done/Released in Open Source Practice Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request. type:good-first-issue Good for newcomers.
Projects
Archived in project
5 participants