Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#32635 closed defect (bug) (fixed)

Theme unit tests fail if a child theme is present

Reported by: johnbillion's profile johnbillion Owned by: obenland's profile obenland
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.5
Component: Themes Keywords: has-patch commit
Focuses: Cc:

Description

If you place a child theme into your theme directory, the Tests_Theme::test_switch_theme() test will fail.

1) Tests_Theme::test_switch_theme
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'My Child Theme'
+'Twenty Fifteen'

~/tests/phpunit/tests/theme.php:224

Needs investigating.

Attachments (2)

32635.diff (761 bytes) - added by obenland 9 years ago.
32635.2.diff (1.3 KB) - added by wonderboymusic 9 years ago.

Download all attachments as: .zip

Change History (10)

#1 @obenland
9 years ago

I noticed that too, been wanting to investigate that.

#2 @obenland
9 years ago

  • Keywords needs-testing removed
  • Version set to 3.5

Unit tests are failing because if template and stylesheet are passed to switch_theme(), $new_theme gets set before the second argument is appropriately handled, causing 'current_theme' to always be updated to the parent theme's name.

Introduced in [21131].

@obenland
9 years ago

#3 @obenland
9 years ago

  • Component changed from Build/Test Tools to Themes
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to Future Release

32635.diff sets $stylesheet to the second argument when available, always sets $template to the template property of the theme's WP_Theme.

#4 @obenland
9 years ago

  • Milestone changed from Future Release to 4.4

#5 @obenland
9 years ago

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

This ticket was mentioned in Slack in #core by obenland. View the logs.


9 years ago

#7 @wonderboymusic
9 years ago

  • Keywords commit added

32635.2.diff should do it

#8 @obenland
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 33815:

Themes: Get the correct theme when template and stylesheet were both passed as arguments.

Fixes a bug where $new_theme got set before the second argument was
appropriately handled, causing the current_theme option to later always be
updated to the parent theme's name.

Introduced in [21131].

Props obenland, wonderboymusic.
Fixes #32635.

Note: See TracTickets for help on using tickets.