1
+ <?php namespace Scriptotek \Sru ;
2
+
3
+ use \Guzzle \Http \Message \Response as HttpResponse ;
4
+ use \Mockery as m ;
5
+
6
+ class ExplainResponseTest extends TestCase {
7
+
8
+ public function testNormalResponse ()
9
+ {
10
+ $ res = new ExplainResponse ('<?xml version="1.0" encoding="UTF-8"?>
11
+ <sru:explainResponse xmlns:sru="http://www.loc.gov/zing/srw/">
12
+ <sru:version>1.2</sru:version>
13
+ <sru:record>
14
+ <sru:recordPacking>xml</sru:recordPacking>
15
+ <sru:recordSchema>http://explain.z3950.org/dtd/2.0/</sru:recordSchema>
16
+ <sru:recordData>
17
+ <explain xmlns="http://explain.z3950.org/dtd/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://explain.z3950.org/dtd/2.0/ http://explain.z3950.org/dtd/zeerex-2.0.xsd">
18
+ <serverInfo protocol="SRU" transport="http">
19
+ <host>sru.bibsys.no</host>
20
+ <port>80</port>
21
+ <database>biblio</database>
22
+ </serverInfo>
23
+ <databaseInfo>
24
+ <title lang="en" primary="true">BIBSYS Union Catalogue</title>
25
+ <description lang="en">SRU access to the BIBSYS Union Catalogue.</description>
26
+ <contact lang="en">[email protected] </contact>
27
+ <restrictions lang="en">It is prohibited to use this service for bulk downloading of records.</restrictions>
28
+ <links>
29
+ <link type="icon">http://www.bibsys.no/images/logo/bibsys_logo_medium.jpg</link>
30
+ </links>
31
+ </databaseInfo>
32
+ <metaInfo>
33
+ <dateModified>Sat Apr 26 16:47:43 CEST 2014</dateModified>
34
+ </metaInfo>
35
+ <indexInfo>
36
+ <set identifier="info:srw/cql-context-set/1/dc-v1.1" name="dc"/>
37
+ <set identifier="info:srw/cql-context-set/2/rec-1.1" name="rec"/>
38
+ <set identifier="info:srw/cql-context-set/15/norzig-1.1" name="norzig"/>
39
+ <set identifier="info:srw/cql-context-set/1/bib-v1" name="bib"/>
40
+ <set identifier="http://www.bibsys.no/context/bs/1.0" name="bs"/>
41
+ <set identifier="info:srw/cql-context-set/1/cql-v1.2" name="cql"/>
42
+ <index scan="false" search="true" sort="true">
43
+ <title>Identifiserer en bibliografisk enhet</title>
44
+ <map>
45
+ <name set="bs">objektid</name>
46
+ </map>
47
+ </index>
48
+ <index scan="false" search="true" sort="true">
49
+ <title>An unambiguous reference to the resource within a given context.</title>
50
+ <map>
51
+ <name set="dc">identifier</name>
52
+ </map>
53
+ </index>
54
+ <index scan="false" search="true" sort="true">
55
+ <title>nlm nummer</title>
56
+ <map>
57
+ <name set="bs">nlm</name>
58
+ </map>
59
+ </index>
60
+ <index scan="false" search="true" sort="true">
61
+ <title>institusjonsspesifikke emneord</title>
62
+ <map>
63
+ <name set="bs">ubtsy</name>
64
+ </map>
65
+ </index>
66
+ <index scan="false" search="true" sort="true">
67
+ <title>en plassering</title>
68
+ <map>
69
+ <name set="bs">geografisk-emneord</name>
70
+ </map>
71
+ </index>
72
+ <index scan="false" search="true" sort="true">
73
+ <title/>
74
+ <map>
75
+ <name set="bs">antallinstrumenter</name>
76
+ </map>
77
+ </index>
78
+ <index scan="false" search="true" sort="true">
79
+ <title>intern</title>
80
+ <map>
81
+ <name set="bs">issn-annen-manifestasjon</name>
82
+ </map>
83
+ <map>
84
+ <name set="bs">ismn-annen-manifestasjon</name>
85
+ </map>
86
+ <map>
87
+ <name set="bs">isbn-annen-manifestasjon</name>
88
+ </map>
89
+ </index>
90
+ </indexInfo>
91
+ <schemaInfo>
92
+ <schema identifier="info:srw/schema/1/dc-v1.1" name="dc"/>
93
+ <schema identifier="info:lc/xmlns/marcxchange-v1" name="marcxchange"/>
94
+ </schemaInfo>
95
+ <configInfo>
96
+ <default type="relation">=</default>
97
+ <default type="retrieveSchema">marcxchange</default>
98
+ <default type="numberOfRecords">10</default>
99
+ <setting type="maximumRecords">50</setting>
100
+ </configInfo>
101
+ </explain>
102
+ </sru:recordData>
103
+ </sru:record>
104
+ </sru:explainResponse> ' );
105
+
106
+ $ this ->assertNull ($ res ->error );
107
+ $ this ->assertEquals ('1.2 ' , $ res ->version );
108
+ $ this ->assertEquals ('sru.bibsys.no ' , $ res ->host );
109
+ $ this ->assertEquals (80 , $ res ->port );
110
+ $ this ->assertEquals ('biblio ' , $ res ->database ->identifier );
111
+ $ this ->assertEquals ('BIBSYS Union Catalogue ' , $ res ->database ->title );
112
+ $ this ->assertEquals ('SRU access to the BIBSYS Union Catalogue. ' , $ res ->database ->description );
113
+ $ this ->assertCount (7 , $ res ->indexes );
114
+ $ this ->assertFalse ($ res ->indexes [0 ]->scan );
115
+ $ this ->assertTrue ($ res ->indexes [0 ]->sort );
116
+ $ this ->assertTrue ($ res ->indexes [0 ]->search );
117
+ $ this ->assertEquals ('Identifiserer en bibliografisk enhet ' , $ res ->indexes [0 ]->title );
118
+ $ this ->assertEquals ('bs.objektid ' , $ res ->indexes [0 ]->maps [0 ]);
119
+
120
+ }
121
+
122
+ }
0 commit comments