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

Added a test for multisite preview page #438

Closed
wants to merge 2 commits into from
Closed

Added a test for multisite preview page #438

wants to merge 2 commits into from

Conversation

raduconst
Copy link
Contributor

This change is meant to test the PR #357. The problem is that when you're previewing a page on a multisite using subdirectory (not subdomain), the link is

http://eflowmslocal.local/test1?page_id=7&preview_id=7&preview=true

instead of:

http://eflowmslocal.local/test1/?page_id=7&preview_id=7&preview=true

(it's missing the / between test1 and ?page_id).

The solution from the PR is the right one and I want to wrap this up into a test.

Basically, what I'm trying to do is:

  1. check if the current installation is multisite;
  2. create a new blog;
  3. move to it;
  4. create a new page;
  5. check its preview link.

The problem is that the preview link seems to have a broken structure once I create the new blog. This is how the link looks:

http://httpexample.org/sample/?page_id=3&preview=true

The slash appears even though the preview link in the browser is still broken.

raduconst added 2 commits January 30, 2018 10:36
This change is meant to test the PR #357. Basically, what I'm trying to do is check if the current installation is multisite, create a new blog, move to it, create a new page and check its preview link. The problem is that the preview link seems to have a broken structure once I create the new blog.
This change creates the blog on multisite correctly due to the change to factory method. The second change is the $pagenow that's set to index.php. This way, the tested link is the one from the frontpage, not from the dashboard area.
@raduconst
Copy link
Contributor Author

I managed to test the call for the home_url function from fix_post_row_actions.

The second call of the home_url function from get_preview_link is made through a filter and I couldn't reach that point.
I could take advantage of the fact that the function is public but I don't know what are the parameters ($actions and $post) that I should use. I also thought about using a filter inside the test, like here, for example, https://core.trac.wordpress.org/browser/trunk/tests/phpunit/tests/multisite/network.php#L126
but I had no luck with that.

@raduconst
Copy link
Contributor Author

Update: once the PR #442 will be merged, this PR will be enough for testing the slash issue on the preview link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants