Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.1

Bug #17704 Unit tests fail (dir layout?)
Submitted: 2010-08-15 10:27 UTC
From: doconnor Assigned: dbs
Status: Closed Package: File_MARC (version SVN)
PHP Version: 5.3.3 OS:
Roadmaps: (Not assigned)    

 [2010-08-15 10:27 UTC] doconnor (Daniel O'Connor)
Description: ------------ The unit tests aren't happy on the unit test machine - svn mkdir File && svn mv MARC.php File/ (and so on) should make it happy and let you run tests straight from svn. Test script: --------------- pear run-tests -r /home/clockwerx/packages-all/File_MARC/tests/ Expected result: ---------------- Tests run + pass Actual result: -------------- pear run-tests -r /home/clockwerx/packages-all/File_MARC/tests/ Running 36 tests FAIL [ 1/36] marc_001: iterate and pretty print a MARC record[tests/marc_001.phpt] FAIL [ 2/36] marc_002: iterate and pretty print MARC records from a file with multiple records[tests/marc_002.phpt] FAIL [ 3/36] marc_003: getFields() with various regular expressions[tests/marc_003.phpt] FAIL [ 4/36] marc_004: Delete fields and subfields[tests/marc_004.phpt] FAIL [ 5/36] marc_005: Ensure a duplicated record is a deep copy; test deleteFields()[tests/marc_005.phpt] FAIL [ 6/36] marc_006: test read.php[tests/marc_006.phpt] FAIL [ 7/36] marc_007: Use key=>value iteration for tags and codes[tests/marc_007.phpt] FAIL [ 8/36] marc_008: Attempt to open a file that does not exist[tests/marc_008.phpt] FAIL [ 9/36] marc_009: Parse a record where leader record length != real record length[tests/marc_009.phpt] FAIL [10/36] marc_001: iterate and pretty print a MARC record[tests/marc_010.phpt] FAIL [11/36] marc_011: iterate and pretty print a MARC record (SOURCE_STRING)[tests/marc_011.phpt] FAIL [12/36] marc_012: test isControlField() and isDataField() convenience methods[tests/marc_012.phpt] FAIL [13/36] marc_013: test formatField() convenience method[tests/marc_013.phpt] FAIL [14/36] marc_014: Add fields to a MARC record[tests/marc_014.phpt] FAIL [15/36] marc_015: ensure that pandemonium does not occur if a record doesn't have a given field[tests/marc_015.phpt] FAIL [16/36] marc_016: generate a single collection of MARCXML records from a MARC record[tests/marc_016.phpt] FAIL [17/36] marc_017: iterate and print a MARC record to JSON format[tests/marc_017.phpt] FAIL [18/36] marc_018: iterate and print a MARC record to JSON MARC-HASH format[tests/marc_018.phpt] FAIL [19/36] marc_16783: iterate and pretty print a non-compliant MARC record (tag = '30-')[tests/marc_16783.phpt] FAIL [20/36] marc_field_001: Exercise basic methods for File_MARC_Field class[tests/marc_field_001.phpt] FAIL [21/36] marc_field_002: Create fields with invalid indicators[tests/marc_field_002.phpt] FAIL [22/36] marc_field_003: Add subfields to an existing field[tests/marc_field_003.phpt] FAIL [23/36] marc_field_004: Add subfields to an existing field (corner case)[tests/marc_field_004.phpt] FAIL [24/36] marc_record_001: create a MARC record from scratch[tests/marc_record_001.phpt] FAIL [25/36] marc_subfield_001: Exercise basic methods for File_MARC_Subfield class[tests/marc_subfield_001.phpt] FAIL [26/36] marc_subfield_002: Exercise setter and isEmpty() methods for File_MARC_Subfield class[tests/marc_subfield_002.phpt] FAIL [27/36] marc_xml_001: iterate and pretty print a MARC record[tests/marc_xml_001.phpt] FAIL [28/36] marc_xml_002: iterate and pretty print a MARC record (LOC standard)[tests/marc_xml_002.phpt] FAIL [29/36] marc_xml_003: Round-trip a MARCXML record to MARC21 (LOC standard)[tests/marc_xml_003.phpt] FAIL [30/36] marc_xml_004: test conversion to XML of subfields that need to be escaped[tests/marc_xml_004.phpt] FAIL [31/36] marc_xml_005: Round-trip a MARCXML record with a root element of "record" to MARC21[tests/marc_xml_005.phpt] FAIL [32/36] marc_xml_006: test getFields() in XML[tests/marc_xml_006.phpt] FAIL [33/36] marc_xml_007: test getTag(), isControlField(), and isDataField() convenience methods on MARCXML[tests/marc_xml_007.phpt] FAIL [34/36] marc_xml_008: generate a single collection of MARCXML records from a MARCXML record[tests/marc_xml_008.phpt] FAIL [35/36] marc_xml_16642: Fix bug 16642: ensure tag and subfield values are returned as strings[tests/marc_xml_16642.phpt] FAIL [36/36] marc_xml_rsinger: iterate and pretty print a non-compliant MARC record (tag = '30-', missing indicator in 245)[tests/marc_xml_rsinger.phpt]


 [2010-08-15 10:27 UTC] doconnor (Daniel O'Connor)
clockwerx@clockwerx-desktop:~/pear/File_MARC/trunk$ pear run-tests -r tests/ even
 [2010-08-15 10:32 UTC] doconnor (Daniel O'Connor)
An additional failure after installing all of the deps / shifting around dir layout: marc_014.phpt fails (php 5.3.2-1ubuntu4.2): 025- 245 04 _aDet osynliga barnet och andra berÀttelser / 025+ 245 04 _aDet osynliga barnet och andra berättelser / 095- 900 1s _aJanssonová, Tove, 095+ 900 1s _aJanssonová, Tove, 116- _bSkönlitteratur 116+ _bSkönlitteratur
 [2010-08-15 17:26 UTC] dbs (Dan Scott)
I would suggest that these should be two separate bugs: one for the failure of marc_014, and one for the layout of the unit tests. I've checked in a fix for marc_014, wrapping the output in utf8_encode() to avoid the mismatch. This only started showing up as a failure once I moved to Fedora 13 as a development platform, so I had intended to eventually investigate whether it was a difference between the PHP options as packaged with Fedora 13 and Ubuntu Lucid, or a change in simple tests, or something else. Wrapping the output in utf8_encode() makes the problem go away, so you can close (this part of) the bug report, but it will probably also result in me forgetting about the underlying problem and never investigating it. As for the directory layout, I struggled with this back in 2006 when I started developing File_MARC and never did work out how to make unit tests work in the installed layout. They work in the SVN directory, which is what I need for development purposes, via: svn co cd trunk pear run-tests tests all works perfectly (assuming, of course, that I've either installed the package & its dependencies via "pear install File_MARC-beta", or manually installed the dependencies). This has the disadvantage of requiring me to copy the updated library files from the repo manually into place in the PEAR directory when I actually run the tests, but I was (ironically enough) trying to err in the direction of making the installed unit tests able to run. When I do try to run the unit tests in the installed PEAR directory as installed by "sudo pear install File_MARC-beta", via a regular user running "pear run-tests /usr/share/pear/test/File_MARC/tests", I get: Warning: fopen(/usr/share/pear/test/File_MARC/tests/marc_001.php): failed to open stream: Permission denied in PEAR/RunTest.php on line 691 ... presumably because run-tests tries to dump the output in /usr/share/pear/test/File_MARC/tests/marc_001.php. "pear help run-tests" doesn't explicitly offer a parameter for a directory in which the output files should be written. If I run the unit tests as root, then they work, but that's a ridiculous solution. Is there some recommended way to make these work? I can't be the only PEAR developer facing this problem.
 [2010-08-15 17:46 UTC] dbs (Dan Scott)
-Status: Open +Status: Closed -Assigned To: +Assigned To: dbs
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at Okay. Your one-liner container the seeds to the solution; I had to move all of the MARC*.php files into place, however: svn mkdir File && svn mv MARC* File/. I've checked in the updated layout and updated package.xml and released 0.6.1 as a result. Hopefully this resolves the problem.