summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-01-24 17:23:59 +0100
committerJoas Schilling <coding@schilljs.com>2018-01-24 17:23:59 +0100
commitc3424df1f026854ed8adbfdf8d96da7a6562a8dd (patch)
tree3147bb402fe417804aac8c278e43d60a5d806f85 /tests
parent5520ba3d15b088e9151ffef89f7cd389c470563b (diff)
downloadnextcloud-server-c3424df1f026854ed8adbfdf8d96da7a6562a8dd.tar.gz
nextcloud-server-c3424df1f026854ed8adbfdf8d96da7a6562a8dd.zip
Require PHPUnit 6.5 or higher
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bootstrap.php4
-rw-r--r--tests/lib/Contacts/ContactsMenu/EntryTest.php3
-rw-r--r--tests/lib/TestCase.php24
-rw-r--r--tests/startsessionlistener.php40
4 files changed, 14 insertions, 57 deletions
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 44c42d353e9..a1bc26bbf0e 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -14,10 +14,6 @@ require_once __DIR__ . '/../lib/base.php';
// load all enabled apps
\OC_App::loadApps();
-if (!class_exists('PHPUnit_Framework_TestCase')) {
- require_once('PHPUnit/Autoload.php');
-}
-
OC_Hook::clear();
set_include_path(get_include_path() . PATH_SEPARATOR . '/usr/share/php');
diff --git a/tests/lib/Contacts/ContactsMenu/EntryTest.php b/tests/lib/Contacts/ContactsMenu/EntryTest.php
index ddc6cc916d7..d5141136a11 100644
--- a/tests/lib/Contacts/ContactsMenu/EntryTest.php
+++ b/tests/lib/Contacts/ContactsMenu/EntryTest.php
@@ -26,10 +26,9 @@ namespace Tests\Contacts\ContactsMenu;
use OC\Contacts\ContactsMenu\Actions\LinkAction;
use OC\Contacts\ContactsMenu\Entry;
-use OCP\Contacts\ContactsMenu\IAction;
use Test\TestCase;
-class EntryTest extends \PHPUnit_Framework_TestCase {
+class EntryTest extends TestCase {
/** @var Entry */
private $entry;
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index 345b2a68e6f..92076580510 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -33,7 +33,7 @@ use OCP\IDBConnection;
use OCP\IL10N;
use OCP\Security\ISecureRandom;
-abstract class TestCase extends \PHPUnit_Framework_TestCase {
+abstract class TestCase extends \PHPUnit\Framework\TestCase {
/** @var \OC\Command\QueueBus */
private $commandBus;
@@ -47,24 +47,6 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
protected $services = [];
/**
- * Wrapper to be forward compatible to phpunit 5.4+
- *
- * @param string $originalClassName
- * @return \PHPUnit_Framework_MockObject_MockObject
- */
- protected function createMock($originalClassName) {
- if (is_callable('parent::createMock')) {
- return parent::createMock($originalClassName);
- }
-
- return $this->getMockBuilder($originalClassName)
- ->disableOriginalConstructor()
- ->disableOriginalClone()
- ->disableArgumentCloning()
- ->getMock();
- }
-
- /**
* @param string $name
* @param mixed $newService
* @return bool
@@ -152,7 +134,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
}
}
- protected function onNotSuccessfulTest($e) {
+ protected function onNotSuccessfulTest(\Throwable $t) {
$this->restoreAllServices();
// restore database connection
@@ -162,7 +144,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
});
}
- parent::onNotSuccessfulTest($e);
+ parent::onNotSuccessfulTest($t);
}
protected function tearDown() {
diff --git a/tests/startsessionlistener.php b/tests/startsessionlistener.php
index 88544cc6ce9..24a72db0065 100644
--- a/tests/startsessionlistener.php
+++ b/tests/startsessionlistener.php
@@ -6,45 +6,25 @@
* See the COPYING-README file.
*/
+use OC\Session\Memory;
+use PHPUnit\Framework\Test;
+use PHPUnit\Framework\TestListener;
+use PHPUnit\Framework\TestListenerDefaultImplementation;
+
/**
* Starts a new session before each test execution
*/
-class StartSessionListener implements PHPUnit_Framework_TestListener {
-
- public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) {
- }
-
- public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {
- }
-
- public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
- }
-
- public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
- }
+class StartSessionListener implements TestListener {
- public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
- }
-
- public function startTest(PHPUnit_Framework_Test $test) {
- }
+ use TestListenerDefaultImplementation;
- public function endTest(PHPUnit_Framework_Test $test, $time) {
+ public function endTest(Test $test, $time) {
// reopen the session - only allowed for memory session
- if (\OC::$server->getSession() instanceof \OC\Session\Memory) {
- /** @var $session \OC\Session\Memory */
+ if (\OC::$server->getSession() instanceof Memory) {
+ /** @var $session Memory */
$session = \OC::$server->getSession();
$session->reopen();
}
}
- public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
- }
-
- public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
- }
-
- public function addWarning(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_Warning $e, $time) {
- }
-
}