Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22989 closed defect (bug) (fixed)

Translation units tests loading test data from non-dynamic path

Reported by: mbijon's profile mbijon Owned by:
Milestone: WordPress.org Priority: normal
Severity: normal Version: 3.5
Component: Unit Tests Keywords: has-patch
Focuses: Cc:

Description

Many of the current translation (pomo) unit tests load test files from paths not prefixed with DIR_TESTDATA.

The problems happen when the bootstrap.php file is located in a different folder from the default. In that case the mentioned tests fail with errors like fopen(data/pomo/{filename}): failed to open stream: No such file or directory.

Reproducing this error

Default bootstrap location, tests succeed:

www/test_svn/bootstrap.php
www/test_svn/tests/
www/test_svn/data/pomo/test_mo.php

Tests fail when bootstrap is moved &/or executed by other files:

www/visualphpunit/bootstrap.php
www/test_svn/tests/
www/test_svn/data/pomo/test_mo.php

The attached patch prefixes all the offending tests with DIR_TESTDATA so they can correctly locate the testdata even when the bootstrap is relocated.

Attachments (1)

22989-UT.diff (11.2 KB) - added by mbijon 11 years ago.
Compatibility revisions to pomo/translation unit tests

Download all attachments as: .zip

Change History (4)

@mbijon
11 years ago

Compatibility revisions to pomo/translation unit tests

#1 @SergeyBiryukov
11 years ago

In 1170/tests:

Use DIR_TESTDATA in pomo tests. props mbijon. see #22989.

#2 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to WordPress.org
  • Resolution set to fixed
  • Status changed from new to closed

Didn't include the formatting changes in [1170/tests]. I guess it's better to leave it as is for now for consistency with the formatting in the other pomo tests.

#3 @mbijon
11 years ago

Thanks @Sergey for adding the error-fixing parts of the fixes.

It's not worth reopening this, but I don't think we should leave old formatting in just because we didn't refactor everything at once. The old test formatting doesn't match the current standards (http://make.wordpress.org/core/handbook/coding-standards/#php), where else should we start?

Note: See TracTickets for help on using tickets.