WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#38853 closed defect (bug) (invalid)

WordPress Test Suite causes Fatal Error when used for Theme Testing

Reported by: michaeltaheri Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Build/Test Tools Keywords: reporter-feedback
Focuses: Cc:

Description (last modified by SergeyBiryukov)

I have been playing with Theme Unit Testing using WP_UnitTestCase for some days, And I might have find an issue here: http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/

It seems a change in testcase.php (line 238) now causes a fatal error when you run phpunit Fatal error: __clone method called on non-object

I have tested this in different situations and systems all with same result, This even happen with WordPress default Theme.

I know that WP_UnitTestCase is not designed for Theme Testing but this can be resolved simply by using an is_object( $hook_object ) condition.

If anyone is wondering how Theme Testing works using WP_UnitTestCase here's a good start

Change History (5)

#1 @dd32
4 years ago

  • Keywords close reporter-feedback added

@michaeltaheri Welcome to Trac :)

As a point of clarification - are you using the unit tests from there with WordPress 4.7/trunk or with 4.6.1?

If you're using 4.6.x you'll need to use the unit tests built with that version of WordPress - http://develop.svn.wordpress.org/branches/4.6/tests/phpunit/ - the unit tests in trunk are designed with changes in 4.7 in mind.

#2 @SergeyBiryukov
4 years ago

  • Description modified (diff)

#3 @SergeyBiryukov
4 years ago

  • Component changed from General to Build/Test Tools

#4 @michaeltaheri
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

@dd32 Thanks, It seems that was the issue, I used the includes folder from version 4.6.1 (http://develop.svn.wordpress.org/tags/4.6.1/tests/phpunit/includes/) and the error was gone.

I also tested the nightly build with nightly unit tests and it was working fine for Theme Testing as well.

It seems this bug report is invalid then :)

#5 @dd32
4 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted

Thanks for the follow up @michaeltaheri! Glad to hear you got it working :)

Note: See TracTickets for help on using tickets.