diff options
-rw-r--r-- | src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig | 2 | ||||
-rw-r--r-- | tests/Wallabag/UserBundle/Controller/ManageControllerTest.php | 11 |
2 files changed, 12 insertions, 1 deletions
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 @@ | |||
72 | </form> | 72 | </form> |
73 | <p> | 73 | <p> |
74 | {{ form_start(delete_form) }} | 74 | {{ form_start(delete_form) }} |
75 | <button onclick="return confirm('{{ 'user.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'user.form.delete'|trans }}</button> | 75 | <button {% if app.user.id == user.id %}disabled="disabled"{% endif %} onclick="return confirm('{{ 'user.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'user.form.delete'|trans }}</button> |
76 | {{ form_end(delete_form) }} | 76 | {{ form_end(delete_form) }} |
77 | </p> | 77 | </p> |
78 | <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('user_index') }}">{{ 'user.form.back_to_list'|trans }}</a></p> | 78 | <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('user_index') }}">{{ 'user.form.back_to_list'|trans }}</a></p> |
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 | |||
68 | // Check the user has been delete on the list | 68 | // Check the user has been delete on the list |
69 | $this->assertNotRegExp('/Foo User/', $client->getResponse()->getContent()); | 69 | $this->assertNotRegExp('/Foo User/', $client->getResponse()->getContent()); |
70 | } | 70 | } |
71 | |||
72 | public function testDeleteDisabledForLoggedUser() | ||
73 | { | ||
74 | $this->logInAs('admin'); | ||
75 | $client = $this->getClient(); | ||
76 | |||
77 | $crawler = $client->request('GET', '/users/'.$this->getLoggedInUserId().'/edit'); | ||
78 | $disabled = $crawler->selectButton('user.form.delete')->extract('disabled'); | ||
79 | |||
80 | $this->assertEquals('disabled', $disabled[0]); | ||
81 | } | ||
71 | } | 82 | } |