Bug 20912: (QA follow-up) The default rule already has renewalsallowed=0
[koha.git] / t / Koha_Util_MARC.t
index daf91f0..3e205c9 100755 (executable)
@@ -4,18 +4,18 @@
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 # Note that at present this test is almost identical to the one testing
 # the encapsulating method in Koha::MetadataRecord.
@@ -38,55 +38,43 @@ $marcrecord->add_fields(
         );
 my $samplehash = [
     {
-        'field' => [
-            {
-                'value' => '1234',
-                'tag'   => '001',
-            }
-        ]
+        'value' => '1234',
+        'tag'   => '001',
     },
     {
-        'field' => [
+        'subfield' => [
             {
-                'subfield' => [
-                    {
-                        'value'  => 'Cooking',
-                        'subtag' => 'a'
-                    }
-                ],
-                'indicator2' => ' ',
-                'tag'        => 150,
-                'indicator1' => ' ',
+                'value'  => 'Cooking',
+                'subtag' => 'a'
             }
-        ]
+        ],
+        'indicator2' => ' ',
+        'tag'        => 150,
+        'indicator1' => ' ',
     },
     {
-        'field' => [
+        'subfield' => [
+            {
+                'value'  => 'Cookery',
+                'subtag' => 'a'
+            },
             {
-                'subfield' => [
-                    {
-                        'value'  => 'Cookery',
-                        'subtag' => 'a'
-                    },
-                    {
-                        'value' => 'Instructional manuals',
-                        'subtag' => 'z'
-                    }
-                ],
-                'indicator2' => ' ',
-                'tag'        => 450,
-                'indicator1' => ' ',
+                'value'  => 'Instructional manuals',
+                'subtag' => 'z'
             }
-        ]
+        ],
+        'indicator2' => ' ',
+        'tag'        => 450,
+        'indicator1' => ' ',
     }
 ];
 
 my $hash = Koha::Util::MARC::createMergeHash($marcrecord);
 my %fieldkeys;
 foreach my $field (@$hash) {
-    $fieldkeys{delete $field->{'field'}->[0]->{'key'}}++;
-    if (defined $field->{'field'}->[0]->{'subfield'}) {
-        foreach my $subfield (@{$field->{'field'}->[0]->{'subfield'}}) {
+    $fieldkeys{delete $field->{'key'}}++;
+    if (defined $field->{'subfield'}) {
+        foreach my $subfield (@{$field->{'subfield'}}) {
             $fieldkeys{delete $subfield->{'subkey'}}++;
         }
     }