Make WordPress Core

Opened 8 years ago

Closed 6 years ago

#37375 closed defect (bug) (fixed)

Several test setUp() methods don't call parent::setUp()

Reported by: johnbillion's profile johnbillion Owned by: johnbillion's profile johnbillion
Milestone: 5.1 Priority: normal
Severity: minor Version:
Component: Build/Test Tools Keywords: has-patch commit
Focuses: Cc:

Description

This needs verification and proper testing, but I noticed a bunch of test classes don't call parent::setUp() within their own setUp() methods.

Attachments (2)

37375.patch (3.3 KB) - added by johnbillion 8 years ago.
37375.2.diff (4.7 KB) - added by birgire 7 years ago.

Download all attachments as: .zip

Change History (10)

@johnbillion
8 years ago

#1 @johnbillion
8 years ago

  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to Future Release

#2 @Frank Klein
7 years ago

  • Keywords needs-testing removed

Could not find any issues on local.

#3 @johnbillion
7 years ago

  • Keywords commit added
  • Milestone changed from Future Release to 5.0
  • Owner set to johnbillion
  • Status changed from new to accepted

#4 @birgire
7 years ago

It looks like there are two more:

tests/phpunit/tests/oembed/WpEmbed.php:
tests/phpunit/tests/taxonomy/getObjectTaxonomies.php:

I also noticed that in:

tests/phpunit/tests/image/editor.php

a little mismatch in the method's name, i.e. Tests_Image_Editor::setup() instead of Tests_Image_Editor::setUp().

@birgire
7 years ago

#5 @birgire
7 years ago

37375.2.diff adds the parent::setUp() call in

  • Tests_Taxonomy_GetObjectTaxonomies:setUp(),
  • Tests_WP_Embed:setUp().

Also includes the Tests_Image_Editor::setUp() instead of Tests_Image_Editor::setup().

For the two additional parent::setUp(), I tested:

phpunit --group taxonomy
OK (615 tests, 1424 assertions)

phpunit --group oembed
OK (104 tests, 290 assertions)

#6 @jorbin
6 years ago

  • Milestone changed from 5.0 to 5.1

#7 @desrosj
6 years ago

This is looking good. I just checked the test suite again and appears there are no other functions missed. Good job, @birgire spotting those others.

I opened a PR on GitHub to run the full test suite.

I opened #45931 as a companion ticket for the instances where parent::tearDown() is not called.

#8 @pento
6 years ago

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

In 44577:

Tests: Add missing parent::setUp() calls to all test classes.

Props johnbillion, birgire.
Fixes #37375.

Note: See TracTickets for help on using tickets.