Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#40071 closed defect (bug) (fixed)

Relative path used in test suite forces tests to be ran from tests dir

Reported by: presslabs's profile PressLabs Owned by: adamsilverstein's profile adamsilverstein
Milestone: 5.1 Priority: low
Severity: normal Version: 4.7.3
Component: Build/Test Tools Keywords: has-patch commit
Focuses: Cc:

Description

In the wordPress test suite for version 4.7.3, inside tests/phpunit/tests/rest-api/rest-schema-setup.php line 303 a relative path is used for writing into a file.
Our use case is that the WordPress tests are cloned into our project and they run alongside our own test suite from an upper level directory in an automated build. That makes this specific test to fail since it cannot resolve the relative path correctly and thus the whole build fails.

The suggestion would be to use absolute paths here in order to let others include this test suite as a subset of a bigger test suite and run all of them from top level, without cd-ing into every subset.

Attachments (1)

40071.diff (1.2 KB) - added by johnbillion 8 years ago.

Download all attachments as: .zip

Change History (9)

@johnbillion
8 years ago

#1 @johnbillion
8 years ago

  • Keywords has-patch reporter-feedback needs-testing added
  • Priority changed from normal to low

Thanks for the report @PressLabs. Could you give 40071.diff a test and see if it addresses the issue for you?

Introduced in [40058].

#2 follow-up: @johnbillion
8 years ago

cc @adamsilverstein for sanity check.

#3 in reply to: ↑ 2 @adamsilverstein
8 years ago

Replying to johnbillion:

cc @adamsilverstein for sanity check.

@johnbillion Looks good. I tested this out and verified the fixture file is generated in the correct location when I run phpunit from the root.

Last edited 8 years ago by adamsilverstein (previous) (diff)

#4 @adamsilverstein
8 years ago

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

#5 @PressLabs
8 years ago

I confirm that the fix works.

#6 @adamsilverstein
7 years ago

  • Keywords commit added; reporter-feedback needs-testing removed
  • Milestone changed from Awaiting Review to 5.0

#7 @adamsilverstein
7 years ago

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

In 42741:

Unit Tests: add a DIR_TESTROOT constant to avoid relative paths.

Fix an issue that prevents tests from running correctly when run outside their normal context.

Props PressLabs, johnbillion.
Fixes #40071.

#8 @jorbin
7 years ago

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