Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#35954 closed task (blessed) (fixed)

Prevent test environment contamination when HTTPS related assertions fail

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: Cc:

Description

Several tests which are related to HTTPS alter the $_SERVER['HTTPS'] variable, but then perform assertions before this value is reset. When these assertions fail, it has a knock-on affect for other tests because the resets don't occur, and we get cascading failures as a result.

Ideally we should audit every one of our tests to ensure any environment changes (including things such as post type registration, messing with other superglobals, etc) only perform their assertions after the resets happen, but the HTTPS tests are what I'm focusing on for now.

Change History (6)

#1 @johnbillion
9 years ago

  • Owner set to johnbillion
  • Status changed from new to accepted

#2 @johnbillion
9 years ago

In 36711:

Move some assertions in HTTPS related tests, so failures that occur before the environment reset don't result in a contaminated test environment.

See #35954

#3 @johnbillion
9 years ago

In 36715:

Unify the initialisation of $_SERVER variables during test bootstrap. This abstracts the (re-)initialisation into a function that can be used inside of tests too, before assertions are performed.

See #35954

#4 @johnbillion
9 years ago

In 36721:

Remove (or at least reduce) the need to reset common $_SERVER variables before assertions or between tests, by introducing a method which automatically resets them during test setup.

See #35954

#5 @johnbillion
9 years ago

In 36722:

Refactor some janky URL tests into data providers for clarity and better error reporting.

See #35954

#6 @johnbillion
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.