WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 3 months ago

#40041 closed defect (bug) (fixed)

Use `markTestSkipped()` vs `echo` in REST API schema initialization tests

Reported by: jeremyfelt Owned by: jeremyfelt
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.8
Component: REST API Keywords: needs-patch
Focuses: rest-api Cc:

Description

[40066] and [40077] use echo() to output test skipped messages. markTestSkipped() should be used for both of these so that the output is not displayed while tests are running.

Change History (7)

#1 @jnylen0
4 months ago

The only part of this test that we should skip is the fixture generation. The assertions there are still valuable.

I didn't see a clear way to accomplish this when I was working on it. Maybe we want to refactor this into two separate tests - one that does the assertions and another (skippable) test that does the fixture generation?

#2 @swissspidy
4 months ago

  • Keywords dev-feedback added

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


3 months ago

#4 @swissspidy
3 months ago

  • Milestone changed from 4.7.4 to 4.8

Moving out of the 4.7.4 milestone as it only affects tests and can be addressed in trunk as well.

#5 follow-up: @jnylen0
3 months ago

We could also just remove these echo statements entirely.

#6 in reply to: ↑ 5 @jeremyfelt
3 months ago

  • Keywords dev-feedback removed

Replying to jnylen0:

We could also just remove these echo statements entirely.

This sounds right if no tests are being skipped. I don't think I looked close enough when opening the ticket to see what the echo was actually communicating.

#7 @jeremyfelt
3 months ago

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

In 40341:

Tests: Consolidate logic used to skip API fixture generation.

This checks for is_multisite() and the minimum PHP version in the same block and removes two echo statements previously used to indicate generation had been skipped.

Fixes #40041.

Note: See TracTickets for help on using tickets.