Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4] Update InMemoryFeatureRepository::remove contract with a Feature instead of FeatureId #5

Merged
merged 3 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -17,8 +17,8 @@
],
"require": {
"php": "^7.4|^8.0",
"pheature/toggle-core": "^0.1",
"pheature/toggle-model": "^0.1",
"pheature/toggle-core": "^0.2",
"pheature/toggle-model": "^0.2",
"webmozart/assert": "^1.10"
},
"require-dev": {
Expand Down
2 changes: 0 additions & 2 deletions grumphp.yml
@@ -1,6 +1,4 @@
grumphp:
git_hook_variables:
EXEC_GRUMPHP_COMMAND: 'docker run -e "TERM=xterm-256color" --tty=true --rm -v $PWD:/code:cached pheature/pheature-php-dev:latest'
hooks_dir: .
hooks_preset: local
tasks:
Expand Down
4 changes: 2 additions & 2 deletions src/InMemoryFeatureRepository.php
Expand Up @@ -18,9 +18,9 @@ public function save(Feature $feature): void
$this->features[$feature->id()] = $feature;
}

public function remove(FeatureId $featureId): void
public function remove(Feature $feature): void
{
unset($this->features[$featureId->value()]);
unset($this->features[$feature->id()]);
}

public function get(FeatureId $featureId): Feature
Expand Down
2 changes: 1 addition & 1 deletion test/InMemoryFeatureRepositoryTest.php
Expand Up @@ -40,7 +40,7 @@ public function testItShouldRemoveSavedFeatureAtInMemoryRepository(): void
$repository = new InMemoryFeatureRepository();
$repository->save($feature);
self::assertSame($feature, $repository->get($featureId));
$repository->remove($featureId);
$repository->remove($feature);
$repository->get($featureId);
}
}