#22989 closed defect (bug) (fixed)
Translation units tests loading test data from non-dynamic path
Reported by: |
|
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)
Change History (4)
#1
@
12 years ago
In 1170/tests:
#2
@
12 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
@
12 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?
Compatibility revisions to pomo/translation unit tests