WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#33752 closed enhancement (invalid)

Allow plugin admin page to skip including admin-footer.php

Reported by: extendwings Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: administration Cc:
PR Number:

Description

I think this helps using unit test for plugins.

Attachments (1)

33752.diff (401 bytes) - added by extendwings 4 years ago.

Download all attachments as: .zip

Change History (4)

@extendwings
4 years ago

#1 follow-up: @johnbillion
4 years ago

  • Keywords reporter-feedback added
  • Version 4.3 deleted

Thanks for the ticket, extendwings.

Can you provide some more information about why this is useful? How are your unit tests running and what are they doing that means that the admin footer causes problems?

#2 in reply to: ↑ 1 ; follow-up: @extendwings
4 years ago

  • Keywords reporter-feedback removed

Replying to johnbillion:

Thanks for the ticket, extendwings.

Can you provide some more information about why this is useful? How are your unit tests running and what are they doing that means that the admin footer causes problems?

In my plugin, I'm using noheader (url query) and exit to output XML data.
But in unit test, exit aborts PHPUnit, unexpectedly.

With nofooter, I don't need to use exit and it is easy to use PHPUnit.

#3 in reply to: ↑ 2 @johnbillion
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Replying to extendwings:

In my plugin, I'm using noheader (url query) and exit to output XML data.
But in unit test, exit aborts PHPUnit, unexpectedly.

Thanks for the info. Have you tested your patch? The AJAX handler in WordPress doesn't output the admin footer (for obvious reasons), so adding a conditional there would not affect your plugin.

Instead, you should split your plugin's show_twiml_page() method into two. One which handles the AJAX processing and one which generates and returns the TwiML. Then you can test the TwiML generation in your unit test, and test the AJAX request and response in an integration test.

Note: See TracTickets for help on using tickets.