Skip to content

Commit

Permalink
qandidate/toggle ^2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
othillo committed Mar 30, 2020
1 parent ba632bf commit c5a89de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 1 addition & 5 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@
});

$app->delete('/toggles/{name}', function ($name) use ($app) {
$removed = $app['toggle.manager']->remove($name);

if (!$removed) {
return new Response(sprintf('Unable to delete toggle "%s"', $name), 400);
}
$app['toggle.manager']->remove($name);

return new Response('OK');
});
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
"php": ">=7.2",
"ext-json": "*",
"silex/silex": "^1.0",
"qandidate/toggle": "^0.2@dev",
"qandidate/toggle": "^2.0",
"predis/service-provider": "^0.4@dev",
"asm89/stack-cors": "^1.0",
"vlucas/phpdotenv": "^2.0"
},
"require-dev": {
"symfony/browser-kit": "^3.4||^4.0||^5.0",
"symfony/browser-kit": "^3.4",
"phpunit/phpunit": "~4.8",
"broadway/coding-standard": "^1.0",
"phpstan/phpstan": "@stable"
Expand Down
6 changes: 4 additions & 2 deletions test/Qandidate/Application/Toggle/TogglesEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function it_exposes_all_toggle_names(): void
],
],
'status' => 'conditionally-active',
'strategy' => 'affirmative',
],
]
),
Expand Down Expand Up @@ -76,12 +77,12 @@ public function it_can_delete_a_toggle(): void
/**
* @test
*/
public function it_returns_400_on_deleting_non_existing_toggle(): void
public function it_does_not_error_when_deleting_non_existing_toggle(): void
{
$client = $this->createClient();
$crawler = $client->request('DELETE', '/toggles/nothere');

$this->assertFalse($client->getResponse()->isOk());
$this->assertTrue($client->getResponse()->isOk());
}

/**
Expand All @@ -99,6 +100,7 @@ public function it_updates_a_toggle_on_put(): void
],
],
'status' => 'conditionally-active',
'strategy' => 'affirmative',
];
$toggle = json_encode($toggleData);

Expand Down

0 comments on commit c5a89de

Please sign in to comment.