Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d562b8f364
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 68 lines (57 sloc) 1.367 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
--TEST--
marc_003: getFields() with various regular expressions
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$dir = dirname(__FILE__);
require 'File/MARC.php';
$marc_file = new File_MARC($dir . '/' . 'music.mrc');

print "Test with a simple string\n";
while ($marc_record = $marc_file->next()) {
  print "\nNext record:\n";
  $fields = $marc_record->getFields('650');
  foreach ($fields as $field) {
    print $field;
    print "\n";
  }
}

print "\nTest with regular expression\n";
$marc_file = new File_MARC($dir . '/' . 'music.mrc');
while ($marc_record = $marc_file->next()) {
  print "\nNext record:\n";
  $fields = $marc_record->getFields('00\d', true);
  foreach ($fields as $field) {
    print $field;
    print "\n";
  }
}

?>
--EXPECT--
Test with a simple string

Next record:
650 0 _aJazz.
650 0 _aMotion picture music
_vExcerpts
_vScores.

Next record:
650 0 _aJazz
_y1971-1980.

Next record:
650 0 _aJazz.

Test with regular expression

Next record:
001 000073594
004 AAJ5802
005 20030415102100.0
008 801107s1977 nyujza

Next record:
001 001878039
005 20050110174900.0
007 sd fungnn|||e|
008 940202r19931981nyujzn i d

Next record:
001 001964482
005 20060626132700.0
007 sd fzngnn|m|e|
008 871211p19871957nyujzn d
Something went wrong with that request. Please try again.