Skip to content

Commit 74652a3

Browse files
committed
Fix Location::glue and add tests
1 parent 48c987c commit 74652a3

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

src/Fields/Location.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
class Location extends Field implements FieldInterface
1919
{
20+
public static $glue = ' ';
21+
2022
/**
2123
* @var array List of properties to be included when serializing the record using the `toArray()` method.
2224
*/

tests/LocationTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use File_MARC_Data_Field;
6+
use File_MARC_Subfield;
7+
use Scriptotek\Marc\Fields\Location;
8+
9+
class LocationTest extends TestCase
10+
{
11+
public function setUp()
12+
{
13+
$field = new File_MARC_Data_Field('852', array(
14+
new File_MARC_Subfield('b', '1030310'),
15+
new File_MARC_Subfield('c', 'k00481'),
16+
new File_MARC_Subfield('h', '793.24'),
17+
new File_MARC_Subfield('i', 'Cra'),
18+
new File_MARC_Subfield('x', 'A non-public note'),
19+
new File_MARC_Subfield('z', 'A public note'),
20+
21+
));
22+
$this->loc = new Location($field);
23+
}
24+
25+
public function testCallcode()
26+
{
27+
$this->assertEquals('793.24 Cra', strval($this->loc->callcode));
28+
}
29+
30+
public function testLocation()
31+
{
32+
$this->assertNull($this->loc->location);
33+
}
34+
35+
public function testSublocation()
36+
{
37+
$this->assertEquals('1030310', strval($this->loc->sublocation));
38+
}
39+
40+
public function testShelvinglocation()
41+
{
42+
$this->assertEquals('k00481', strval($this->loc->shelvinglocation));
43+
}
44+
45+
public function testPublicNote()
46+
{
47+
$this->assertEquals('A public note', strval($this->loc->publicNote));
48+
}
49+
50+
public function testNonPublicNote()
51+
{
52+
$this->assertEquals('A non-public note', strval($this->loc->nonPublicNote));
53+
}
54+
}

0 commit comments

Comments
 (0)