[Pkg-owncloud-commits] [owncloud] 04/06: Upgrade to use latest phpunit - fixes #16669

David Prévot taffit at moszumanska.debian.org
Tue Jun 2 01:40:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v6.0.8RC2
in repository owncloud.

commit 1b0756e49a08d1ce67824cd51cbc696feb1a40a8
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Mon Jun 1 21:11:01 2015 +0200

    Upgrade to use latest phpunit - fixes #16669
---
 apps/files_encryption/lib/helper.php                        | 11 ++++++++---
 tests/lib/appframework/middleware/MiddlewareTest.php        |  6 ++++--
 .../middleware/security/SecurityMiddlewareTest.php          | 13 ++++++++++---
 tests/phpunit-autotest.xml                                  |  1 -
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index 787a6ea..1bd21f9 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -367,9 +367,14 @@ class Helper {
 		$post = 0;
 		if(count($_POST) > 0) {
 			$post = 1;
-			}
-			header('Location: ' . $location . '?p=' . $post . '&errorCode=' . $errorCode);
-			exit();
+		}
+
+		if(defined('PHPUNIT_RUN') and PHPUNIT_RUN) {
+			throw new \Exception("Encryption error: $errorCode");
+		}
+
+		header('Location: ' . $location . '?p=' . $post . '&errorCode=' . $errorCode);
+		exit();
 	}
 
 	/**
diff --git a/tests/lib/appframework/middleware/MiddlewareTest.php b/tests/lib/appframework/middleware/MiddlewareTest.php
index 7a93c0d..c315f9c 100644
--- a/tests/lib/appframework/middleware/MiddlewareTest.php
+++ b/tests/lib/appframework/middleware/MiddlewareTest.php
@@ -44,8 +44,10 @@ class MiddlewareTest extends \PHPUnit_Framework_TestCase {
 	protected function setUp(){
 		$this->middleware = new ChildMiddleware();
 
-		$this->api = $this->getMock('OC\AppFramework\DependencyInjection\DIContainer',
-					array(), array('test'));
+		$this->api = $this->getMockBuilder(
+			'OC\AppFramework\DependencyInjection\DIContainer')
+			->disableOriginalConstructor()
+			->getMock();
 
 		$this->controller = $this->getMock('OCP\AppFramework\Controller',
 				array(), array($this->api, new Request()));
diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
index dae6135..6473d30 100644
--- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
+++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php
@@ -39,7 +39,10 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
 	private $request;
 
 	public function setUp() {
-		$api = $this->getMock('OC\AppFramework\DependencyInjection\DIContainer', array(), array('test'));
+		$api = $this->getMockBuilder(
+			'OC\AppFramework\DependencyInjection\DIContainer')
+			->disableOriginalConstructor()
+			->getMock();
 		$this->controller = $this->getMock('OCP\AppFramework\Controller',
 				array(), array($api, new Request()));
 
@@ -297,7 +300,11 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
 
 
 	public function testAfterExceptionReturnsRedirect(){
-		$api = $this->getMock('OC\AppFramework\DependencyInjection\DIContainer', array(), array('test'));
+		$api = $this->getMockBuilder(
+			'OC\AppFramework\DependencyInjection\DIContainer')
+			->disableOriginalConstructor()
+			->getMock();
+
 		$serverMock = $this->getMock('\OC\Server', array('getNavigationManager'));
 		$api->expects($this->once())->method('getServer')
 			->will($this->returnValue($serverMock));
@@ -309,7 +316,7 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase {
 			array('server' => array('HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')));
 		$this->middleware = new SecurityMiddleware($api, $this->request);
 		$response = $this->middleware->afterException($this->controller, 'test',
-				$this->secException);
+			$this->secException);
 
 		$this->assertTrue($response instanceof RedirectResponse);
 	}
diff --git a/tests/phpunit-autotest.xml b/tests/phpunit-autotest.xml
index a893e96..766f2b7 100644
--- a/tests/phpunit-autotest.xml
+++ b/tests/phpunit-autotest.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <phpunit bootstrap="bootstrap.php"
-		 strict="true"
 		 verbose="true"
 		 timeoutForSmallTests="900"
 		 timeoutForMediumTests="900"

-- 
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