summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-28 15:23:57 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-28 15:23:57 +0200
commitd5e48a48062d1b82dbdbae36d9f045d344204ec6 (patch)
tree71eacc491c06506e2e8884daee808e7fd9cd2f42
parent5e9ea2b3659eebf6d21c253771e477abe16496c9 (diff)
downloadnextcloud-server-d5e48a48062d1b82dbdbae36d9f045d344204ec6.tar.gz
nextcloud-server-d5e48a48062d1b82dbdbae36d9f045d344204ec6.zip
fix assertions
-rw-r--r--tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
index ae0b05bdb3c..47556ca9542 100644
--- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
+++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
@@ -119,11 +119,17 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
} catch (SecurityException $ex){
$this->assertEquals($status, $ex->getCode());
}
+
+ // add assertion if everything should work fine otherwise phpunit will
+ // complain
+ if ($status === 0) {
+ $this->assertTrue(true);
+ }
}
public function testAjaxStatusLoggedInCheck() {
$this->ajaxExceptionStatus(
- 'testAjaxStatusLoggedInCheck',
+ __FUNCTION__,
'isLoggedIn',
Http::STATUS_UNAUTHORIZED
);
@@ -131,11 +137,10 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
/**
* @NoCSRFRequired
- * @NoAdminRequired
*/
public function testAjaxNotAdminCheck() {
$this->ajaxExceptionStatus(
- 'testAjaxNotAdminCheck',
+ __FUNCTION__,
'isAdminUser',
Http::STATUS_FORBIDDEN
);
@@ -146,7 +151,7 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
*/
public function testAjaxStatusCSRFCheck() {
$this->ajaxExceptionStatus(
- 'testAjaxStatusCSRFCheck',
+ __FUNCTION__,
'passesCSRFCheck',
Http::STATUS_PRECONDITION_FAILED
);
@@ -158,22 +163,22 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
*/
public function testAjaxStatusAllGood() {
$this->ajaxExceptionStatus(
- 'testAjaxStatusAllGood',
+ __FUNCTION__,
'isLoggedIn',
0
);
$this->ajaxExceptionStatus(
- 'testAjaxStatusAllGood',
+ __FUNCTION__,
'isAdminUser',
0
);
$this->ajaxExceptionStatus(
- 'testAjaxStatusAllGood',
+ __FUNCTION__,
'isSubAdminUser',
0
);
$this->ajaxExceptionStatus(
- 'testAjaxStatusAllGood',
+ __FUNCTION__,
'passesCSRFCheck',
0
);
@@ -215,7 +220,7 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
if($shouldFail){
$this->setExpectedException('\OC\AppFramework\Middleware\Security\SecurityException');
} else {
- $this->setExpectedException(null);
+ $this->assertTrue(true);
}
$this->reader->reflect(__CLASS__, $method);