Skip to content

Commit

Permalink
[BUGFIX] Fix getStructureDepth() to match its documentation (#1379)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Meyer <[email protected]>
  • Loading branch information
beatrycze-volk and sebastian-meyer authored Dec 16, 2024
1 parent 225bbfa commit 73aa654
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Classes/Common/MetsDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -1137,9 +1137,9 @@ public function getStructureDepth(string $logId)
$ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*');
if (!empty($ancestors)) {
return count($ancestors);
} else {
return 0;
}

return false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/Common/MetsDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,6 @@ public function canGetStructureDepth()
self::assertEquals(3, $correct);

$incorrect = $doc->getStructureDepth('ID_DOES_NOT_EXIST');
self::assertEquals(0, $incorrect);
self::assertFalse($incorrect);
}
}

0 comments on commit 73aa654

Please sign in to comment.