Current File : //opt/alt/php56/usr/share/pear/test/File_MARC/tests/marc_020.phpt |
--TEST--
marc_020: Test MARC binary output
--SKIPIF--
<?php include('tests/skipif.inc'); ?>
--FILE--
<?php
$dir = dirname(__FILE__);
require __DIR__ . '/bootstrap.php';
// Get ourselves a MARC record
$marc_file = new File_MARC($dir . '/' . 'example.mrc');
$marc_record = $marc_file->next();
// create some subfields
$subfields[] = new File_MARC_Subfield('a', 'nothing');
$subfields[] = new File_MARC_Subfield('z', 'everything');
// create a data field
$data_field = new File_MARC_Data_Field('100', $subfields, '0');
// append the data field
$marc_record->appendField($data_field);
// create a control field
$ctrl_field = new File_MARC_Control_Field('001', '01234567890');
// prepend the control field
$marc_record->prependField($ctrl_field);
// reproduce test case reported by Mark Jordan
$subfields_966_2[] = new File_MARC_Subfield('l', 'web');
$subfields_966_2[] = new File_MARC_Subfield('r', '0');
$subfields_966_2[] = new File_MARC_Subfield('s', 'b');
$subfields_966_2[] = new File_MARC_Subfield('i', '49');
$subfields_966_2[] = new File_MARC_Subfield('c', '1');
$field_966_2 = new File_MARC_Data_Field('966', $subfields_966_2, null, null);
$marc_record->appendField($field_966_2);
// let's see the results
print convert_uuencode($marc_record->toRaw());
?>
--EXPECT--
M,#$Y-#,@("`@(#(R,#`U-3,@("`T-3`P,#`Q,#`Q,C`P,#`P,#`Q,#`Q,3`P
M,#$R,#`S,#`P-S`P,#(S,#`X,#`S.3`P,#,P,#(P,#`R-C`P,#8Y,#,U,#`Q
M-3`P,#DU,#0P,#`P-S`P,3$P,#0R,#`Q,C`P,3$W,#@T,#`Q.#`P,3(Y,#@T
M,#`Q.#`P,30W,#@T,#`R,3`P,38U,#@T,#`R,C`P,3@V,3`P,#`S,#`P,C`X
M,C0U,#`V,C`P,C,X,C4P,#`Q,S`P,S`P,C8P,#`U.#`P,S$S,S`P,#`S,S`P
M,S<Q-#0P,#`S-S`P-#`T-3`P,#`R,S`P-#0Q-3DY,#`Q,#`P-#8T-S0P,#`R
M-#`P-#<T-S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