ZF-4582: Set of GData unit tests errors: 'failed to open stream: No such file or directory'


{panel} 1) testToAndFromString(Zend_Gdata_Gbase_ItemFeedTest) file_get_contents(Zend/Gdata/Gbase/_files/TestDataGbaseItemFeedSample1.xml): failed to open stream: No such file or directory

2) testToAndFromString(Zend_Gdata_Gbase_SnippetFeedTest) file_get_contents(Zend/Gdata/Gbase/_files/TestDataGbaseSnippetFeedSample1.xml): failed to open stream: No such file or directory

3) testToAndFromString(Zend_Gdata_Spreadsheets_SpreadsheetFeedTest) file_get_contents(Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml): failed to open stream: No such file or directory

4) testToAndFromString(Zend_Gdata_Spreadsheets_WorksheetFeedTest) file_get_contents(Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml): failed to open stream: No such file or directory

5) testToAndFromString(Zend_Gdata_Spreadsheets_ListFeedTest) file_get_contents(Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml): failed to open stream: No such file or directory

6) testToAndFromString(Zend_Gdata_Docs_DocumentListFeedTest) file_get_contents(Zend/Gdata/Docs/_files/TestDataDocumentListFeedSample.xml): failed to open stream: No such file or directory {panel}


I wasn't able to reproduce this on my end.

However, I'm going to try replacing the hard-coded pathnames with calls to dirname(FILE), or similar, and see if that fixes this problem for Alexander.

Erased fix-version as issue is not fixed with this release

Hi Thomas,

Can you describe the environment from which you're running these tests? What directory are you running phpunit from?

When running phpunit from the root of the tests directory, this should work fine:

The function call used in these tests is like this example: file_get_contents('Zend/Gdata/Gbase/_files/TestDataGbaseItemFeedSample1.xml')

The files exist in the 'tests' directory-- example:…

I've always thought that the tests were supposed to be run from the root of the tests directory--- if that's not correct, we can tell file_get_contents to search the include path... but the root of the tests directory will need to be in the include path then too.


Thanks, -Ryan

Hi Ryan,

Tests are intended to be started from the root of tests directory. But it's also useful to run tests separately from their own directories sometimes.

So it's a good practice to use absolute paths based on current script directory (like dirname(__FILE__) . '_files/...')

Tests are passed correctly if they are started from root now. So issue should be closed If you don't plan to change existing code using full pathnames.

Fixed with Rev# 12350

Marking as fixed for 1.7.0.