From b14a9ebeb129b25b4399cce7f361a6bb69e811ab Mon Sep 17 00:00:00 2001 From: Christian Schulz Date: Wed, 14 Apr 2021 11:35:41 +0200 Subject: [PATCH 1/3] - added function to activate user - added function to deactivate user --- src/Api/Users.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Api/Users.php b/src/Api/Users.php index 6d07f8c37..197c96067 100644 --- a/src/Api/Users.php +++ b/src/Api/Users.php @@ -244,6 +244,26 @@ public function unblock(int $id) return $this->post('users/'.self::encodePath($id).'/unblock'); } + /** + * @param int $id + * + * @return mixed + */ + public function activate(int $id) + { + return $this->post('users/'.self::encodePath($id).'/activate'); + } + + /** + * @param int $id + * + * @return mixed + */ + public function deactivate(int $id) + { + return $this->post('users/'.self::encodePath($id).'/deactivate'); + } + /** * @return mixed */ From 4641e569584878c0154b0e837d26a922e6c97880 Mon Sep 17 00:00:00 2001 From: Christian Schulz Date: Wed, 14 Apr 2021 11:51:42 +0200 Subject: [PATCH 2/3] added tests for user activate and user deactivate functions --- tests/Api/UsersTest.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/Api/UsersTest.php b/tests/Api/UsersTest.php index 4dafb0bab..dee422d0d 100644 --- a/tests/Api/UsersTest.php +++ b/tests/Api/UsersTest.php @@ -407,6 +407,40 @@ public function shouldUnblockUser(): void $this->assertEquals($expectedBool, $api->unblock(1)); } + /** + * @test + */ + public function shouldActivateUser(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with('users/1/activate') + ->will($this->returnValue($expectedBool)) + ; + + $this->assertEquals($expectedBool, $api->activate(1)); + } + + /** + * @test + */ + public function shouldDeactivateUser(): void + { + $expectedBool = true; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('post') + ->with('users/1/deactivate') + ->will($this->returnValue($expectedBool)) + ; + + $this->assertEquals($expectedBool, $api->deactivate(1)); + } + /** * @test */ From 810b16957d85419f69787e6817b3911a782e9e5a Mon Sep 17 00:00:00 2001 From: FSD-Christian-ADM Date: Thu, 2 Sep 2021 11:56:39 +0200 Subject: [PATCH 3/3] Update Users.php fixed spacing to pass CI-tests. used tabs instead of 4 spaces --- src/Api/Users.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Api/Users.php b/src/Api/Users.php index 197c96067..bbc828e8f 100644 --- a/src/Api/Users.php +++ b/src/Api/Users.php @@ -244,25 +244,25 @@ public function unblock(int $id) return $this->post('users/'.self::encodePath($id).'/unblock'); } - /** - * @param int $id - * - * @return mixed - */ - public function activate(int $id) - { - return $this->post('users/'.self::encodePath($id).'/activate'); - } - - /** - * @param int $id - * - * @return mixed - */ - public function deactivate(int $id) - { - return $this->post('users/'.self::encodePath($id).'/deactivate'); - } + /** + * @param int $id + * + * @return mixed + */ + public function activate(int $id) + { + return $this->post('users/'.self::encodePath($id).'/activate'); + } + + /** + * @param int $id + * + * @return mixed + */ + public function deactivate(int $id) + { + return $this->post('users/'.self::encodePath($id).'/deactivate'); + } /** * @return mixed