From: Jeremy Benoist Date: Sun, 2 Oct 2016 11:21:45 +0000 (+0200) Subject: Disabled delete button for the logged user X-Git-Tag: 2.1.0~7^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;ds=sidebyside;h=ccc7faec094387681a59faa5ca79a86e33f06972;hp=eb4142e0afa5c83c9e301e38e57a72322be05e8c;p=github%2Fwallabag%2Fwallabag.git Disabled delete button for the logged user To avoid some bad things to happen… --- diff --git a/src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig b/src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig index 5292ba78..d5cf99c3 100644 --- a/src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig +++ b/src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig @@ -72,7 +72,7 @@

{{ form_start(delete_form) }} - + {{ form_end(delete_form) }}

{{ 'user.form.back_to_list'|trans }}

diff --git a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php index 247eb6ba..19b824b8 100644 --- a/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php +++ b/tests/Wallabag/UserBundle/Controller/ManageControllerTest.php @@ -68,4 +68,15 @@ class ManageControllerTest extends WallabagCoreTestCase // Check the user has been delete on the list $this->assertNotRegExp('/Foo User/', $client->getResponse()->getContent()); } + + public function testDeleteDisabledForLoggedUser() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/users/'.$this->getLoggedInUserId().'/edit'); + $disabled = $crawler->selectButton('user.form.delete')->extract('disabled'); + + $this->assertEquals('disabled', $disabled[0]); + } }