Skip to content

Commit

Permalink
Fix messages
Browse files Browse the repository at this point in the history
  • Loading branch information
whikloj committed Apr 17, 2024
1 parent 54f611d commit 9380b60
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Bag.php
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ public function setAlgorithms(array $algorithms): void
$internal_names = array_map(self::class . '::getHashName', $algorithms);
$valid_algorithms = array_filter($internal_names, [$this, 'hashIsSupported']);
if (count($valid_algorithms) !== count($algorithms)) {
throw new BagItException("One or more of the algorithms provided are supported.");
throw new BagItException("One or more of the algorithms provided are NOT supported.");
}
$this->setAlgorithmsInternal($valid_algorithms);
}
Expand Down Expand Up @@ -1203,7 +1203,7 @@ public function addTagFile(string $source, string $dest): void
$this->checkTagFileConstraints($dest);
$external = $this->makeAbsolute($dest);
if (file_exists($external)) {
throw new BagItException("Tag file ($dest) already exists in the bag, use ->replaceTagFile() to replace.");
throw new BagItException("Tag file ($dest) already exists in the bag.");
}
$this->setExtended(true);
$parentDirs = dirname($external);
Expand Down
2 changes: 1 addition & 1 deletion tests/BagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public function testSetAlgorithmsFailure(): void
$bag = Bag::create($this->tmpdir);
$this->assertArrayEquals(['sha512'], $bag->getAlgorithms());
$this->expectException(BagItException::class);
$this->expectExceptionMessage("One or more of the algorithms provided are supported.");
$this->expectExceptionMessage("One or more of the algorithms provided are NOT supported.");
$bag->setAlgorithms(['sha1', 'SHA-224', "bad-algorithm"]);
}

Expand Down
4 changes: 1 addition & 3 deletions tests/ExtendedBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1105,9 +1105,7 @@ public function testAddTagNotOverwrite(): void
$bag->addTagFile($special_file, 'special.txt');
$this->assertFileExists($bag->getBagRoot() . '/special.txt');
$this->expectException(BagItException::class);
$this->expectExceptionMessage(
"Tag file (special.txt) already exists in the bag, use ->replaceTagFile() to replace."
);
$this->expectExceptionMessage("Tag file (special.txt) already exists in the bag.");
$bag->addTagFile($special_file, 'special.txt');
}

Expand Down

0 comments on commit 9380b60

Please sign in to comment.