Skip to content

Commit

Permalink
Cover the new private function shared by addTagFile and removeTagFile
Browse files Browse the repository at this point in the history
  • Loading branch information
whikloj committed Apr 17, 2024
1 parent 9380b60 commit da015fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/BagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1021,9 +1021,9 @@ public function testAddBagInfoWhenNotExtended(): void
{
$bag = Bag::create($this->tmpdir);
$this->assertFalse($bag->isExtended());
$bag->addBagInfoTag("Contact-Name", "Jared Whiklo");
$bag->addBagInfoTag("Contact-Name", "Bob Smith");
$this->assertTrue($bag->isExtended());
$this->assertArrayEquals(["Jared Whiklo"], $bag->getBagInfoByTag("Contact-Name"));
$this->assertArrayEquals(["Bob Smith"], $bag->getBagInfoByTag("Contact-Name"));
}

/**
Expand Down
8 changes: 8 additions & 0 deletions tests/ExtendedBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ public function testExtendedBagWithoutBagInfo(): void
* Test trying to add a tag file with a non-existant file.
* @group Extended
* @covers ::addTagFile
* @covers ::checkTagFileConstraints
*/
public function testAddTagFileFileDoesNotExist(): void
{
Expand All @@ -1006,6 +1007,7 @@ public function testAddTagFileFileDoesNotExist(): void
* Test trying to add a tag file over the bag-info.txt file.
* @group Extended
* @covers ::addTagFile
* @covers ::checkTagFileConstraints
*/
public function testAddTagFileCannotOverwriteBagInfo(): void
{
Expand All @@ -1021,6 +1023,7 @@ public function testAddTagFileCannotOverwriteBagInfo(): void
* Test trying to add a tag file over the bagit.txt file.
* @group Extended
* @covers ::addTagFile
* @covers ::checkTagFileConstraints
*/
public function testAddTagCannotOverwriteBagIt(): void
{
Expand All @@ -1036,6 +1039,7 @@ public function testAddTagCannotOverwriteBagIt(): void
* Test trying to add a tag file over a payload manifest file.
* @group Extended
* @covers ::addTagFile
* @covers ::checkTagFileConstraints
*/
public function testAddTagCannotOverwritePayloadManifest(): void
{
Expand All @@ -1052,6 +1056,7 @@ public function testAddTagCannotOverwritePayloadManifest(): void
* Test trying to add a tag file over a tag manifest file.
* @group Extended
* @covers ::addTagFile
* @covers ::checkTagFileConstraints
*/
public function testAddTagCannotOverwriteTagManifest(): void
{
Expand All @@ -1069,6 +1074,7 @@ public function testAddTagCannotOverwriteTagManifest(): void
* Test trying to add a tag file to the data directory.
* @group Extended
* @covers ::addTagFile
* @covers ::checkTagFileConstraints
*/
public function testAddTagCannotBeInDataDirectory(): void
{
Expand All @@ -1083,6 +1089,7 @@ public function testAddTagCannotBeInDataDirectory(): void
* Test trying to add a tag file to the data directory.
* @group Extended
* @covers ::addTagFile
* @covers ::checkTagFileConstraints
*/
public function testAddTagCannotBeInDataDirectory2(): void
{
Expand Down Expand Up @@ -1113,6 +1120,7 @@ public function testAddTagNotOverwrite(): void
* Test adding a tag file to the bag.
* @group Extended
* @covers ::addTagFile
* @covers ::checkTagFileConstraints
*/
public function testAddTagFileSuccess(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ManifestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testCheckManifests(): void
'tag' => $bag->getBagRoot() . '/tagmanifest-sha256.txt',
];
$bag->setExtended(true);
$bag->addBagInfoTag('Contact-name', 'Jared Whiklo');
$bag->addBagInfoTag('Contact-name', 'Bob Smith');
$bag->setAlgorithm('sha256');
$bag->createFile("This is some sample text", 'some/directory/file.txt');

Expand Down

0 comments on commit da015fe

Please sign in to comment.