Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#28986 closed defect (bug) (worksforme)

Define expected hooks in WP_UnitTestCase::$hooks_saved

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

Description

From r29251.

Can cause error notices in third-party uses of WP_UnitTestCase

Attachments (1)

28986.1.diff (594 bytes) - added by danielbachhuber 10 years ago.

Download all attachments as: .zip

Change History (7)

#1 @wonderboymusic
10 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 29267:

After [29251], set the array keys in WP_UnitTestCase::$hooks_saved to prevent notices in 3rd party use cases.

Props danielbachhuber.
Fixes #28986.

#2 @TobiasBg
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This breaks things.

When $hooks_saved is pre-populated (non-empty arrays are true), if ( ! self::$hooks_saved ) { is never true and therefore the hooks are never backed-up.

#3 @ocean90
10 years ago

  • Keywords needs-patch added; has-patch commit removed

#4 @danielbachhuber
10 years ago

This may have been user error on my part. I just realized I'm not calling parent::setUp() in my subclass, and now I can't even reproduce the original bug.

Please do revert. I'll come back if I can track down what exactly happened.

#5 @helen
10 years ago

In 29274:

Revert [29267], as it causes unit test breakage and appears unnecessary. see #28986.

#6 @helen
10 years ago

  • Keywords needs-patch removed
  • Milestone 4.0 deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.