WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 22 months ago

#42277 closed enhancement (fixed)

Remove useless tests from `Tests_Basic`

Reported by: Frank Klein Owned by: johnbillion
Milestone: 5.1 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-unit-tests
Focuses: Cc:

Description

The Tests_Basic class contains several tests, which do not seem to be testing anything useful:

  • test_globals() and test_globals_bar(): The bug in question has been fixed for a long time, plus issues with PHPUnit should be handled upstream.
  • test_setting_nonexistent_arrays(), test_magic_getter(), test_subclass_magic_getter(), test_call_method(), test_subclass_magic_getter(), test_call_method(), test_subclass_call_method(), test_subclass_isset(), and test_subclass_unset() all needlessly test basic PHP features.
  • _switch_order_helper() is unused, except in it's test_switch_order() test, and since Tests_Basic is a test class, it can be removed.

Some of these tests have been added for HHVM support, but are no longer needed after this support was removed as part of #40548.

Attachments (1)

42277.diff (3.8 KB) - added by Frank Klein 3 years ago.

Download all attachments as: .zip

Change History (10)

#1 @johnbillion
3 years ago

  • Keywords needs-unit-tests added
  • Version trunk deleted

@Frank Klein
3 years ago

#2 @johnbillion
3 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed
  • Milestone changed from Awaiting Review to 5.0
  • Owner set to johnbillion
  • Status changed from new to reviewing

#3 @johnbillion
3 years ago

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

In 42381:

Build/Test tools: Remove unnecessary PHP functionality tests from the test suite.

Props Frank Klein
Fixes #42277

#4 @TimothyBlynJacobs
2 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Why were the basic object classes removed? See #37523

#5 @Frank Klein
2 years ago

@TimothyBlynJacobs They were removed because they do not actually test anything, besides normal PHP behaviour.

Is there a use case for the WordPress Core tests that was missed?

#6 @TimothyBlynJacobs
2 years ago

Because they are helpful objects when writing tests with the WP test lib. I don't see any issue with removing the unnecessary PHP functionality tests, but I don't see why the basic object classes themselves were removed.

#7 @Frank Klein
2 years ago

They were removed because Core does not need them anymore. In my view there's enough outstanding work on tests that we should not continue to invest resources into code that is no longer needed.

Consider including these classes in your own testing setup if you find them useful.

#8 @johnbillion
2 years ago

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

Yeah this is a real edge case and we have more pressing issues to deal with. I'd recommend implementing these classes in your own test suite.

#9 @jorbin
22 months ago

  • Milestone changed from 5.0 to 5.1
Note: See TracTickets for help on using tickets.