[Pkg-owncloud-commits] [owncloud] 120/165: Fix several minor things
David Prévot
taffit at moszumanska.debian.org
Thu Apr 23 04:06:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 3f96662609a93f4da653c5962175ae42f4768fc1
Author: Joas Schilling <nickvergessen at owncloud.com>
Date: Mon Apr 20 17:44:34 2015 +0200
Fix several minor things
---
apps/encryption/controller/settingscontroller.php | 30 ++++++++++------------
.../tests/controller/SettingsControllerTest.php | 15 ++++++-----
2 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/apps/encryption/controller/settingscontroller.php b/apps/encryption/controller/settingscontroller.php
index ec45b05..1555ff0 100644
--- a/apps/encryption/controller/settingscontroller.php
+++ b/apps/encryption/controller/settingscontroller.php
@@ -19,14 +19,13 @@
*
*/
-
namespace OCA\Encryption\Controller;
-
use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\KeyManager;
use OCA\Encryption\Session;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IL10N;
use OCP\IRequest;
@@ -110,31 +109,28 @@ class SettingsController extends Controller {
$result = true;
}
} else {
- $result = false;
- $errorMessage = $this->l->t(
- 'The old password was not correct, please try again.');
+ $errorMessage = $this->l->t('The old password was not correct, please try again.');
}
} else {
- $result = false;
- $errorMessage = $this->l->t(
- 'The current log-in password was not correct, please try again.');
+ $errorMessage = $this->l->t('The current log-in password was not correct, please try again.');
}
if ($result === true) {
$this->session->setStatus(Session::INIT_SUCCESSFUL);
return new DataResponse(
- array(
- 'status' => 'success',
- 'data' => array(
- 'message' => (string) $this->l->t('Private key password successfully updated.'))
- )
+ ['data' => [
+ 'status' => 'success',
+ 'message' => (string) $this->l->t('Private key password successfully updated.'),
+ ],
+ ]
);
} else {
return new DataResponse(
- array(
- 'data' => array
- ('message' => (string) $errorMessage)
- )
+ ['data' => [
+ 'message' => (string) $errorMessage,
+ ],
+ ],
+ Http::STATUS_BAD_REQUEST
);
}
diff --git a/apps/encryption/tests/controller/SettingsControllerTest.php b/apps/encryption/tests/controller/SettingsControllerTest.php
index 37a6765..a127737 100644
--- a/apps/encryption/tests/controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/controller/SettingsControllerTest.php
@@ -19,12 +19,11 @@
*
*/
-
namespace OCA\Encryption\Tests\Controller;
-
use OCA\Encryption\Controller\SettingsController;
use OCA\Encryption\Session;
+use OCP\AppFramework\Http;
use Test\TestCase;
class SettingsControllerTest extends TestCase {
@@ -53,7 +52,7 @@ class SettingsControllerTest extends TestCase {
/** @var \PHPUnit_Framework_MockObject_MockObject */
private $sessionMock;
- public function setUp() {
+ protected function setUp() {
parent::setUp();
@@ -65,7 +64,8 @@ class SettingsControllerTest extends TestCase {
$this->l10nMock->expects($this->any())
->method('t')
->will($this->returnCallback(function($message) {
- return $message; }));
+ return $message;
+ }));
$this->userManagerMock = $this->getMockBuilder('OCP\IUserManager')
->disableOriginalConstructor()->getMock();
@@ -85,7 +85,7 @@ class SettingsControllerTest extends TestCase {
'logout',
'setUser',
'getUser',
- 'canChangePassword'
+ 'canChangePassword',
])
->getMock();
@@ -129,6 +129,7 @@ class SettingsControllerTest extends TestCase {
$data = $result->getData();
+ $this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus());
$this->assertSame('The current log-in password was not correct, please try again.',
$data['data']['message']);
}
@@ -155,6 +156,7 @@ class SettingsControllerTest extends TestCase {
$data = $result->getData();
+ $this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus());
$this->assertSame('The old password was not correct, please try again.',
$data['data']['message']);
}
@@ -212,8 +214,7 @@ class SettingsControllerTest extends TestCase {
$data = $result->getData();
- $this->assertSame('success', $data['status']);
-
+ $this->assertSame(Http::STATUS_OK, $result->getStatus());
$this->assertSame('Private key password successfully updated.',
$data['data']['message']);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list