From 9380b60cc3fab37d31437a0952ac4ab0e97674af Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Wed, 17 Apr 2024 13:23:03 -0500 Subject: [PATCH] Fix messages --- src/Bag.php | 4 ++-- tests/BagTest.php | 2 +- tests/ExtendedBagTest.php | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Bag.php b/src/Bag.php index 5c4b620..f4f9f19 100644 --- a/src/Bag.php +++ b/src/Bag.php @@ -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); } @@ -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); diff --git a/tests/BagTest.php b/tests/BagTest.php index 8459645..bd37cd8 100644 --- a/tests/BagTest.php +++ b/tests/BagTest.php @@ -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"]); } diff --git a/tests/ExtendedBagTest.php b/tests/ExtendedBagTest.php index 27c1bc9..b7ac710 100644 --- a/tests/ExtendedBagTest.php +++ b/tests/ExtendedBagTest.php @@ -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'); }