PR-staging Unit/System Tests

Pending

User tests: Successful: Unsuccessful:

avatar anibalsanchez
anibalsanchez
2 May 2017

Pull Request for Issue #15737 .

Summary of Changes

Fixed JApplicationWeb to generate the redirection headers with the same headers API that it is called on respond().

Now, it is generating the headers adding them as a raw header. If the there's an extra Status (e.g. a 201 defined with setHeader), it replaces the 303.

Testing Instructions

Test that all redirections work Ok. For example, when items are saved.

This issue was discovered with an extension running on FOF2 (the controller defined a Status 201 and, in a second step, calls a redirection). So, any extension running FOF2 is also a good test (save items).

Expected result

All redirections work OK.

Actual result

When multiple statuses are defined, the 303 redirection is lost and the status defined with setHeader('Status'... overrides any previous header('HTTP 1.1 303 See other');

Documentation Changes Required

avatar anibalsanchez anibalsanchez - open - 2 May 2017
avatar anibalsanchez anibalsanchez - change - 2 May 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 May 2017
Category Libraries
avatar wilsonge
wilsonge - comment - 2 May 2017

Unit test failures need investigating. The HTTP/1.1 being repeated in the status code definitely looks unintended?

avatar wilsonge
wilsonge - comment - 2 May 2017

anibalsanchez#1 Adds a unit test for the bug fix being made

avatar anibalsanchez anibalsanchez - change - 2 May 2017
Labels Added: PR-staging
avatar joomla-cms-bot joomla-cms-bot - change - 2 May 2017
Category Libraries Libraries Unit Tests
avatar wilsonge wilsonge - change - 3 May 2017
Labels Added: Unit/System Tests
avatar wilsonge
wilsonge - comment - 5 May 2017

@anibalsanchez you need to look at the unit test fails here

avatar anibalsanchez
anibalsanchez - comment - 5 May 2017

Hi @wilsonge , not sure why the unit test does not work. The change is a simple call to a different API to generate the same headers... so it shouldn't generate an invalid header.

avatar anibalsanchez
anibalsanchez - comment - 6 May 2017

Hi @wilsonge ,

I've just fixed the issues on the unit tests. Some notes:

The translation of the 'status' to HTTP/1.1 was not sending the parameters required by JApplicationCmsTest/testRedirect.

  • In JApplicationWebTest/testRedirectWithExistingStatusCode, setHeader('status', 201) can also be setHeader('Status', 201), since setHeader is case-sensitive. So, the case difference produces different tests results. I have created testRedirectWithExistingStatusCode1 and testRedirectWithExistingStatusCode2 to check the results of status and Status.

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15738.
avatar rdeutz
rdeutz - comment - 14 May 2017

I have tested this item successfully on f826300


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15738.

avatar rdeutz rdeutz - test_item - 14 May 2017 - Tested successfully
avatar rdeutz
rdeutz - comment - 15 May 2017

Would be good to have more tests, if someone needs a component, this one http://babioon.com/en/component/ars/repository/babioon-event/babioon-event-3-0-0/babioon-event-3-0-0.html fails

avatar brianteeman
brianteeman - comment - 15 May 2017

Tested using the component from @rdeutz
Before the PR saving an existing item gave a white page
After the PR the article saved as expected

avatar brianteeman
brianteeman - comment - 15 May 2017

I have tested this item successfully on f6fe521


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15738.

avatar brianteeman brianteeman - test_item - 15 May 2017 - Tested successfully
avatar rdeutz rdeutz - change - 15 May 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-05-15 09:11:21
Closed_By rdeutz
avatar rdeutz rdeutz - close - 15 May 2017
avatar rdeutz rdeutz - merge - 15 May 2017

Add a Comment

Login with GitHub to post a comment