View | Details | Raw Unified | Return to bug 37639
Collapse All | Expand All

(-)a/t/db_dependent/api/v1/items.t (-46 / +93 lines)
Lines 48-98 subtest 'to_api_mapping() tests' => sub { Link Here
48
    $schema->storage->txn_begin;
48
    $schema->storage->txn_begin;
49
49
50
    my $mapping = Koha::Item->to_api_mapping;
50
    my $mapping = Koha::Item->to_api_mapping;
51
    is($mapping->{itemnumber}, 'item_id', 'items.itemnumber is mapped as item_id in to_api_mapping');
51
    is( $mapping->{itemnumber},       'item_id',     'items.itemnumber is mapped as item_id in to_api_mapping' );
52
    is($mapping->{biblionumber}, 'biblio_id', 'items.biblionumber is mapped as biblio_id in to_api_mapping');
52
    is( $mapping->{biblionumber},     'biblio_id',   'items.biblionumber is mapped as biblio_id in to_api_mapping' );
53
    is($mapping->{biblioitemnumber}, undef, 'items.biblionumber is mapped as undef in to_api_mapping');
53
    is( $mapping->{biblioitemnumber}, undef,         'items.biblionumber is mapped as undef in to_api_mapping' );
54
    is($mapping->{barcode}, 'external_id', 'items.barcode is mapped as external_id in to_api_mapping');
54
    is( $mapping->{barcode},          'external_id', 'items.barcode is mapped as external_id in to_api_mapping' );
55
    is($mapping->{dateaccessioned}, 'acquisition_date', 'items.dateaccessioned is mapped as acquisition_date in to_api_mapping');
55
    is(
56
    is($mapping->{booksellerid}, 'acquisition_source', 'items.booksellerid is mapped as acquisition_source in to_api_mapping');
56
        $mapping->{dateaccessioned}, 'acquisition_date',
57
    is($mapping->{homebranch}, 'home_library_id', 'items.homebranch is mapped as home_libray_id in to_api_mapping');
57
        'items.dateaccessioned is mapped as acquisition_date in to_api_mapping'
58
    is($mapping->{price}, 'purchase_price', 'items.price is mapped as purchase_price in to_api_mapping');
58
    );
59
    is($mapping->{replacementprice}, 'replacement_price', 'items.replacementprice is mapped as replacement_price in to_api_mapping');
59
    is(
60
    is($mapping->{replacementpricedate}, 'replacement_price_date', 'items.replacementpricedate is mapped as replacement_price_date in to_api_mapping');
60
        $mapping->{booksellerid}, 'acquisition_source',
61
    is($mapping->{datelastborrowed}, 'last_checkout_date', 'items.datelastborrowered is mapped as last_checkout_date in to_api_mapping');
61
        'items.booksellerid is mapped as acquisition_source in to_api_mapping'
62
    is($mapping->{datelastseen}, 'last_seen_date', 'items.datelastseen is mapped as last_seen_date in to_api_mapping');
62
    );
63
    is($mapping->{stack}, 'stack', 'items.stack is mapped as stack in to_api_mapping');
63
    is( $mapping->{homebranch}, 'home_library_id', 'items.homebranch is mapped as home_libray_id in to_api_mapping' );
64
    is($mapping->{notforloan}, 'not_for_loan_status', 'items.notforloan is mapped as not_for_loan_status in to_api_mapping');
64
    is( $mapping->{price},      'purchase_price',  'items.price is mapped as purchase_price in to_api_mapping' );
65
    is($mapping->{damaged}, 'damaged_status', 'items.damaged is mapped as damaged_status in to_api_mapping');
65
    is(
66
    is($mapping->{damaged_on}, 'damaged_date', 'items.damaged_on is mapped as damaged_date in to_api_mapping');
66
        $mapping->{replacementprice}, 'replacement_price',
67
    is($mapping->{itemlost}, 'lost_status', 'items.itemlost is mapped as lost_status in to_api_mapping');
67
        'items.replacementprice is mapped as replacement_price in to_api_mapping'
68
    is($mapping->{itemlost_on}, 'lost_date', 'items.itemlost_on is mapped as lost_date in to_api_mapping');
68
    );
69
    is($mapping->{withdrawn}, 'withdrawn', 'items.withdrawn is mapped as withdrawn in to_api_mapping');
69
    is(
70
    is($mapping->{withdrawn_on}, 'withdrawn_date', 'items.withdrawn_date is mapped as withdrawn in to_api_mapping');
70
        $mapping->{replacementpricedate}, 'replacement_price_date',
71
    is($mapping->{itemcallnumber}, 'callnumber', 'items.itemcallnumber is mapped as callnumber in to_api_mapping');
71
        'items.replacementpricedate is mapped as replacement_price_date in to_api_mapping'
72
    is($mapping->{coded_location_qualifier}, 'coded_location_qualifier', 'items.coded_location_qualifier is mapped as coded_location_qualifier in to_api_mapping');
72
    );
73
    is($mapping->{issues}, 'checkouts_count', 'items.issues is mapped as checkouts_count in to_api_mapping');
73
    is(
74
    is($mapping->{renewals}, 'renewals_count', 'items.renewals is mapped as renewals_count in to_api_mapping');
74
        $mapping->{datelastborrowed}, 'last_checkout_date',
75
    is($mapping->{reserves}, 'holds_count', 'items.reserves is mapped as holds_count in to_api_mapping');
75
        'items.datelastborrowered is mapped as last_checkout_date in to_api_mapping'
76
    is($mapping->{restricted}, 'restricted_status', 'items.restricted is mapped as restricted_status in to_api_mapping');
76
    );
77
    is($mapping->{itemnotes}, 'public_notes', 'items.itemnotes is mapped as public_notes in to_api_mapping');
77
    is(
78
    is($mapping->{itemnotes_nonpublic}, 'internal_notes', 'items.itemnotes_nonpublic is mapped as internal_notes in to_api_mapping');
78
        $mapping->{datelastseen}, 'last_seen_date',
79
    is($mapping->{holdingbranch}, 'holding_library_id', 'items.holdingbranch is mapped as holding_library_id in to_api_mapping');
79
        'items.datelastseen is mapped as last_seen_date in to_api_mapping'
80
    is($mapping->{timestamp}, 'timestamp', 'items.timestamp is mapped as timestamp in to_api_mapping');
80
    );
81
    is($mapping->{location}, 'location', 'items.location is mapped as location in to_api_mapping');
81
    is( $mapping->{stack}, 'shelving_control_number', 'items.stack is mapped as stack in to_api_mapping' );
82
    is($mapping->{permanent_location}, 'permanent_location', 'items.permanent_location is mapped as permanent_location in to_api_mapping');
82
    is(
83
    is($mapping->{onloan}, 'checked_out_date', 'items.onloan is mapped as checked_out_date in to_api_mapping');
83
        $mapping->{notforloan}, 'not_for_loan_status',
84
    is($mapping->{cn_source}, 'call_number_source', 'items.cnsource is mapped as call_number_source in to_api_mapping');
84
        'items.notforloan is mapped as not_for_loan_status in to_api_mapping'
85
    is($mapping->{cn_sort}, 'call_number_sort', 'items.cnsort is mapped as call_number_sort in to_api_mapping');
85
    );
86
    is($mapping->{ccode}, 'collection_code', 'items.ccode is mapped as collection_code in to_api_mapping');
86
    is( $mapping->{damaged},        'damaged_status', 'items.damaged is mapped as damaged_status in to_api_mapping' );
87
    is($mapping->{materials}, 'materials_notes', 'items.materials is mapped as materials_notes in to_api_mapping');
87
    is( $mapping->{damaged_on},     'damaged_date',   'items.damaged_on is mapped as damaged_date in to_api_mapping' );
88
    is($mapping->{uri}, 'uri', 'items.uri is mapped as uri in to_api_mapping');
88
    is( $mapping->{itemlost},       'lost_status',    'items.itemlost is mapped as lost_status in to_api_mapping' );
89
    is($mapping->{itype}, 'item_type_id', 'items.itype is mapped as item_type_id in to_api_mapping');
89
    is( $mapping->{itemlost_on},    'lost_date',      'items.itemlost_on is mapped as lost_date in to_api_mapping' );
90
    is($mapping->{more_subfields_xml}, 'extended_subfields', 'items.more_subfields_xml is mapped as extended_subfields in to_api_mapping');
90
    is( $mapping->{withdrawn},      'withdrawn',      'items.withdrawn is mapped as withdrawn in to_api_mapping' );
91
    is($mapping->{enumchron}, 'serial_issue_number', 'items.enumchron is mapped as serial_issue_number in to_api_mapping');
91
    is( $mapping->{withdrawn_on},   'withdrawn_date', 'items.withdrawn_date is mapped as withdrawn in to_api_mapping' );
92
    is($mapping->{copynumber}, 'copy_number', 'items.copynumber is mapped as copy_number in to_api_mapping');
92
    is( $mapping->{itemcallnumber}, 'callnumber', 'items.itemcallnumber is mapped as callnumber in to_api_mapping' );
93
    is($mapping->{stocknumber}, 'inventory_number', 'items.stocknumber is mapped as inventory_number in to_api_mapping');
93
    is(
94
    is($mapping->{new_status}, 'new_status', 'items.new_status is mapped as new_status in to_api_mapping');
94
        $mapping->{coded_location_qualifier}, 'coded_location_qualifier',
95
    is($mapping->{deleted_on}, undef, 'items.deleted_on is mapped as undef in to_api_mapping');
95
        'items.coded_location_qualifier is mapped as coded_location_qualifier in to_api_mapping'
96
    );
97
    is( $mapping->{issues},   'checkouts_count', 'items.issues is mapped as checkouts_count in to_api_mapping' );
98
    is( $mapping->{renewals}, 'renewals_count',  'items.renewals is mapped as renewals_count in to_api_mapping' );
99
    is( $mapping->{reserves}, 'holds_count',     'items.reserves is mapped as holds_count in to_api_mapping' );
100
    is(
101
        $mapping->{restricted}, 'restricted_status',
102
        'items.restricted is mapped as restricted_status in to_api_mapping'
103
    );
104
    is( $mapping->{itemnotes}, 'public_notes', 'items.itemnotes is mapped as public_notes in to_api_mapping' );
105
    is(
106
        $mapping->{itemnotes_nonpublic}, 'internal_notes',
107
        'items.itemnotes_nonpublic is mapped as internal_notes in to_api_mapping'
108
    );
109
    is(
110
        $mapping->{holdingbranch}, 'holding_library_id',
111
        'items.holdingbranch is mapped as holding_library_id in to_api_mapping'
112
    );
113
    is( $mapping->{timestamp}, 'timestamp', 'items.timestamp is mapped as timestamp in to_api_mapping' );
114
    is( $mapping->{location},  'location',  'items.location is mapped as location in to_api_mapping' );
115
    is(
116
        $mapping->{permanent_location}, 'permanent_location',
117
        'items.permanent_location is mapped as permanent_location in to_api_mapping'
118
    );
119
    is( $mapping->{onloan}, 'checked_out_date', 'items.onloan is mapped as checked_out_date in to_api_mapping' );
120
    is(
121
        $mapping->{cn_source}, 'call_number_source',
122
        'items.cnsource is mapped as call_number_source in to_api_mapping'
123
    );
124
    is( $mapping->{cn_sort},   'call_number_sort', 'items.cnsort is mapped as call_number_sort in to_api_mapping' );
125
    is( $mapping->{ccode},     'collection_code',  'items.ccode is mapped as collection_code in to_api_mapping' );
126
    is( $mapping->{materials}, 'materials_notes',  'items.materials is mapped as materials_notes in to_api_mapping' );
127
    is( $mapping->{uri},       'uri',              'items.uri is mapped as uri in to_api_mapping' );
128
    is( $mapping->{itype},     'item_type_id',     'items.itype is mapped as item_type_id in to_api_mapping' );
129
    is(
130
        $mapping->{more_subfields_xml}, 'extended_subfields',
131
        'items.more_subfields_xml is mapped as extended_subfields in to_api_mapping'
132
    );
133
    is(
134
        $mapping->{enumchron}, 'serial_issue_number',
135
        'items.enumchron is mapped as serial_issue_number in to_api_mapping'
136
    );
137
    is( $mapping->{copynumber}, 'copy_number', 'items.copynumber is mapped as copy_number in to_api_mapping' );
138
    is(
139
        $mapping->{stocknumber}, 'inventory_number',
140
        'items.stocknumber is mapped as inventory_number in to_api_mapping'
141
    );
142
    is( $mapping->{new_status}, 'new_status', 'items.new_status is mapped as new_status in to_api_mapping' );
143
    is( $mapping->{deleted_on}, undef,        'items.deleted_on is mapped as undef in to_api_mapping' );
96
144
97
    is( scalar keys %{$mapping}, 45, 'Correct number of columns in mapping' );
145
    is( scalar keys %{$mapping}, 45, 'Correct number of columns in mapping' );
98
146
99
- 

Return to bug 37639