Skip to content

Commit

Permalink
remove deletNote() as it was only used in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
limenet committed Aug 1, 2023
1 parent 14427df commit 6e7a4d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
16 changes: 0 additions & 16 deletions src/Repository/ConfigurationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,22 +328,6 @@ public function modifyNote(string $className, string $attributeName, ?string $no
$this->setConfig($config);
}

/**
* Deletes a class-attribute note.
*
* @param class-string $className
*/
public function deleteNote(string $className, string $attributeName): void
{
if (!$this->isClassConfigured($className) || !$this->isAttributeConfigured($className, $attributeName)) {
return;
}

$config = $this->getConfig();
$config[Configuration::CONFIG_KEY_CLASSES][$className][Configuration::CONFIG_KEY_CLASSES_ATTRIBUTES][$attributeName][Configuration::CONFIG_KEY_CLASSES_ATTRIBUTES_NOTE] = null;
$this->setConfig($config);
}

/**
* Given a class name, return the corresponding config for $attribute.
*
Expand Down
12 changes: 2 additions & 10 deletions tests/Config/ConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,8 @@ public function testWriteNote(): void
$configurationRepository->modifyNote($this->className, $this->attributeName, 'ipsum');
$this->assertSame('ipsum', $configurationRepository->getNoteForAttribute($this->className, $this->attributeName));

$configurationRepository->deleteNote($this->className, $this->attributeName);
$configurationRepository->deleteNote($this->className, $this->attributeName);
$this->assertNull($configurationRepository->getNoteForAttribute($this->className, $this->attributeName));

$configurationRepository->deleteNote($this->className, $this->attributeNameOther);
$this->assertNull($configurationRepository->getNoteForAttribute($this->className, $this->attributeNameOther));

$this->assertNull($configurationRepository->getNoteForAttribute($this->classNameOther, $this->attributeName));
$configurationRepository->deleteNote($this->classNameOther, $this->attributeName);
$this->assertNull($configurationRepository->getNoteForAttribute($this->classNameOther, $this->attributeName));
$configurationRepository->modifyNote($this->className, $this->attributeName, '');
$this->assertSame('', $configurationRepository->getNoteForAttribute($this->className, $this->attributeName));
}

public function testWriteDoubleAdd(): void
Expand Down

0 comments on commit 6e7a4d3

Please sign in to comment.