Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
whikloj committed Apr 17, 2024
1 parent 9ee89b1 commit 859c829
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/Bag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
31 changes: 31 additions & 0 deletions tests/Profiles/BagProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public function testSetManifestAllowedInvalid(): void
/**
* @group Profiles
* @covers ::setAllowFetchTxt
* @covers ::setRequireFetchTxt
*/
public function testAllowFetchInvalid(): void
{
Expand Down Expand Up @@ -201,6 +202,7 @@ public function testAllowFetchInvalid(): void
/**
* @group Profiles
* @covers ::setRequireFetchTxt
* @covers ::setAllowFetchTxt
* @covers ::isRequireFetchTxt
*/
public function testRequireFetchValid(): void
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 859c829

Please sign in to comment.