From 859c8298a8e7be6b75d98d6de50b337e86c2103c Mon Sep 17 00:00:00 2001 From: Jared Whiklo Date: Sun, 14 Apr 2024 22:02:59 -0500 Subject: [PATCH] More tests --- src/Bag.php | 8 -------- tests/Profiles/BagProfileTest.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/Bag.php b/src/Bag.php index 8e20c7f..b6943fc 100644 --- a/src/Bag.php +++ b/src/Bag.php @@ -1268,14 +1268,6 @@ public function removeTagFile(string $dest): void $this->changed = true; } - /** - * @return bool True if the bag was loaded from a serialized format. - */ - public function hasSerialization(): bool - { - return $this->serialization_extension !== null; - } - /** * @return string|null The serialization format if the bag was loaded from a serialized format or null. */ diff --git a/tests/Profiles/BagProfileTest.php b/tests/Profiles/BagProfileTest.php index d92cfb4..80018e9 100644 --- a/tests/Profiles/BagProfileTest.php +++ b/tests/Profiles/BagProfileTest.php @@ -172,6 +172,7 @@ public function testSetManifestAllowedInvalid(): void /** * @group Profiles * @covers ::setAllowFetchTxt + * @covers ::setRequireFetchTxt */ public function testAllowFetchInvalid(): void { @@ -201,6 +202,7 @@ public function testAllowFetchInvalid(): void /** * @group Profiles * @covers ::setRequireFetchTxt + * @covers ::setAllowFetchTxt * @covers ::isRequireFetchTxt */ public function testRequireFetchValid(): void @@ -362,4 +364,33 @@ public function testTagManifestAllowed(): void $this->assertTrue($profile->isValid()); $this->assertArrayEquals(["md5"], $profile->getTagManifestsAllowed()); } + + public function testTagFilesMissingFromAllowed(): void + { + $profileJson = <<< JSON +{ + "BagIt-Profile-Info":{ + "BagIt-Profile-Identifier":"http://somewhere.org/my/profile.json", + "BagIt-Profile-Version": "0.1", + "Source-Organization":"Monsters, Inc.", + "Contact-Name":"Mike Wazowski", + "External-Description":"Profile for testing tag files required and allowed", + "Version":"0.3" + }, + "Tag-Files-Required": [ + "Special-tag-file.txt" + ], + "Tag-Files-Allowed": [ + "Special-tag-file.txt", + "Another-special-tag-file.txt" + ], + "Serialization": "forbidden", + "Accept-BagIt-Version":[ + "1.0" + ] +} +JSON; + $profile = BagItProfile::fromJson($profileJson); + $this->assertTrue($profile->isValid()); + } }