summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-08-09 22:08:02 +0200
committerGitHub <noreply@github.com>2017-08-09 22:08:02 +0200
commit3b955a16252a4581251368638038da11812fa94c (patch)
tree251257a05962eeebf645a2ed3e141ce9b4af5c9e
parente08768ee04635d017a3f2f87e7ac6b1859f733dc (diff)
parentc6f6413bb195f043e6054bc8b38dedcf1bfdf6cc (diff)
downloadnextcloud-server-3b955a16252a4581251368638038da11812fa94c.tar.gz
nextcloud-server-3b955a16252a4581251368638038da11812fa94c.zip
Merge pull request #5791 from nextcloud/add-php7.2-tests
[CI] Add PHP 7.2 testing container
-rw-r--r--.drone.yml22
-rw-r--r--apps/files_sharing/tests/CacheTest.php4
-rw-r--r--apps/user_ldap/tests/User/UserTest.php2
-rw-r--r--apps/user_ldap/tests/User_LDAPTest.php9
-rw-r--r--lib/private/AppFramework/Http/Request.php2
-rw-r--r--lib/private/Files/Storage/FailedStorage.php2
-rw-r--r--lib/private/Lockdown/Filesystem/NullStorage.php2
-rw-r--r--lib/private/Mail/Mailer.php2
-rw-r--r--lib/private/Mail/Message.php4
-rw-r--r--lib/private/Route/Route.php11
-rw-r--r--tests/Core/Controller/LoginControllerTest.php4
-rw-r--r--tests/Core/Controller/LostControllerTest.php4
-rw-r--r--tests/lib/Files/Cache/CacheTest.php4
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php5
-rw-r--r--tests/lib/Repair/RepairMimeTypesTest.php14
-rw-r--r--tests/lib/User/SessionTest.php11
16 files changed, 81 insertions, 21 deletions
diff --git a/.drone.yml b/.drone.yml
index a8d1940d9de..0cfbe6403dc 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -171,6 +171,14 @@ pipeline:
matrix:
DB: NODB
PHP: 7.1
+ nodb-php7.2:
+ image: nextcloudci/php7.2:php7.2-4
+ commands:
+ - NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
+ when:
+ matrix:
+ DB: NODB
+ PHP: 7.2
sqlite-php5.6:
image: nextcloudci/php5.6:php5.6-7
commands:
@@ -195,6 +203,14 @@ pipeline:
matrix:
DB: sqlite
PHP: 7.1
+ sqlite-php7.2:
+ image: nextcloudci/php7.2:php7.2-4
+ commands:
+ - NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
+ when:
+ matrix:
+ DB: sqlite
+ PHP: 7.2
mysql-php5.6:
image: nextcloudci/php5.6:php5.6-7
commands:
@@ -599,6 +615,9 @@ matrix:
- DB: NODB
PHP: 7.1
ENABLE_REDIS: true
+ - DB: NODB
+ PHP: 7.2
+ ENABLE_REDIS: false
- DB: sqlite
PHP: 5.6
ENABLE_REDIS: true
@@ -608,6 +627,9 @@ matrix:
- DB: sqlite
PHP: 7.1
ENABLE_REDIS: true
+ - DB: sqlite
+ PHP: 7.2
+ ENABLE_REDIS: false
- DB: mysql
PHP: 5.6
ENABLE_REDIS: true
diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php
index 26ba5b21e46..82f4ad62f67 100644
--- a/apps/files_sharing/tests/CacheTest.php
+++ b/apps/files_sharing/tests/CacheTest.php
@@ -243,7 +243,7 @@ class CacheTest extends TestCase {
$id2 = $this->sharedCache->get('subdir/another too.txt')['fileid'];
$id3 = $this->sharedCache->get('subdir/not a text file.xml')['fileid'];
$id4 = $this->sharedCache->get('subdir/another.txt')['fileid'];
- $tagManager = \OC::$server->getTagManager()->load('files', null, null, $userId);
+ $tagManager = \OC::$server->getTagManager()->load('files', [], false, $userId);
$tagManager->tagAs($id1, 'tag1');
$tagManager->tagAs($id1, 'tag2');
$tagManager->tagAs($id2, 'tag1');
@@ -285,7 +285,7 @@ class CacheTest extends TestCase {
$this->sharedCache->get('subdir/emptydir')['fileid'],
$this->sharedCache->get('subdir/emptydir2')['fileid'],
);
- $tagManager = \OC::$server->getTagManager()->load('files', null, null, $userId);
+ $tagManager = \OC::$server->getTagManager()->load('files', [], false, $userId);
foreach ($allIds as $id) {
$tagManager->tagAs($id, 'tag1');
}
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 0437051b134..f48abc9ce4a 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -1269,6 +1269,7 @@ class UserTest extends \Test\TestCase {
return array(
array(
'pwdchangedtime' => array((new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'),
+ 'pwdgraceusetime' => [],
),
);
}
@@ -1342,6 +1343,7 @@ class UserTest extends \Test\TestCase {
array(
'pwdpolicysubentry' => array('cn=custom,ou=policies,dc=foo,dc=bar'),
'pwdchangedtime' => array((new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'),
+ 'pwdgraceusetime' => [],
)
);
}
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php
index aaf67ebcab6..ced5009148d 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -135,6 +135,9 @@ class User_LDAPTest extends TestCase {
return false;
}
}));
+
+ $access->method('fetchUsersByLoginName')
+ ->willReturn([]);
}
/**
@@ -353,6 +356,9 @@ class User_LDAPTest extends TestCase {
$access->expects($this->any())
->method('nextcloudUserNames')
->will($this->returnArgument(0));
+
+ $access->method('fetchUsersByLoginName')
+ ->willReturn([]);
}
public function testGetUsersNoParam() {
@@ -760,6 +766,9 @@ class User_LDAPTest extends TestCase {
$access->expects($this->any())
->method('getUserMapper')
->will($this->returnValue($userMapper));
+
+ $access->method('fetchUsersByLoginName')
+ ->willReturn([]);
}
public function testGetDisplayName() {
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php
index 956744e5d5e..7e21434c734 100644
--- a/lib/private/AppFramework/Http/Request.php
+++ b/lib/private/AppFramework/Http/Request.php
@@ -432,7 +432,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
// 'application/json' must be decoded manually.
if (strpos($this->getHeader('Content-Type'), 'application/json') !== false) {
$params = json_decode(file_get_contents($this->inputStream), true);
- if(count($params) > 0) {
+ if($params !== null && count($params) > 0) {
$this->items['params'] = $params;
if($this->method === 'POST') {
$this->items['post'] = $params;
diff --git a/lib/private/Files/Storage/FailedStorage.php b/lib/private/Files/Storage/FailedStorage.php
index d2aae33bb21..d4046b62fee 100644
--- a/lib/private/Files/Storage/FailedStorage.php
+++ b/lib/private/Files/Storage/FailedStorage.php
@@ -184,7 +184,7 @@ class FailedStorage extends Common {
return true;
}
- public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) {
throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e);
}
diff --git a/lib/private/Lockdown/Filesystem/NullStorage.php b/lib/private/Lockdown/Filesystem/NullStorage.php
index 831d8a8b2a0..3f3aad3df03 100644
--- a/lib/private/Lockdown/Filesystem/NullStorage.php
+++ b/lib/private/Lockdown/Filesystem/NullStorage.php
@@ -157,7 +157,7 @@ class NullStorage extends Common {
return false;
}
- public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) {
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
}
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index e438f75d2ce..d232587df63 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -170,7 +170,7 @@ class Mailer implements IMailer {
}
list($name, $domain) = explode('@', $email, 2);
- $domain = idn_to_ascii($domain);
+ $domain = idn_to_ascii($domain, 0,INTL_IDNA_VARIANT_UTS46);
return $name.'@'.$domain;
}
diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php
index 5ffc050360a..2d3c49d0ce1 100644
--- a/lib/private/Mail/Message.php
+++ b/lib/private/Mail/Message.php
@@ -58,11 +58,11 @@ class Message {
foreach($addresses as $email => $readableName) {
if(!is_numeric($email)) {
list($name, $domain) = explode('@', $email, 2);
- $domain = idn_to_ascii($domain);
+ $domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
$convertedAddresses[$name.'@'.$domain] = $readableName;
} else {
list($name, $domain) = explode('@', $readableName, 2);
- $domain = idn_to_ascii($domain);
+ $domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
$convertedAddresses[$email] = $name.'@'.$domain;
}
}
diff --git a/lib/private/Route/Route.php b/lib/private/Route/Route.php
index 3a953af9011..c25d08e8bc2 100644
--- a/lib/private/Route/Route.php
+++ b/lib/private/Route/Route.php
@@ -148,11 +148,12 @@ class Route extends SymfonyRoute implements IRoute {
* @return void
*/
public function actionInclude($file) {
- $function = create_function('$param',
- 'unset($param["_route"]);'
- .'$_GET=array_merge($_GET, $param);'
- .'unset($param);'
- .'require_once "'.$file.'";');
+ $function = function($param) use ($file) {
+ unset($param["_route"]);
+ $_GET=array_merge($_GET, $param);
+ unset($param);
+ require_once "'.$file.'";
+ } ;
$this->action($function);
}
}
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index 493bade9dd8..169beff2b9d 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -291,6 +291,10 @@ class LoginControllerTest extends TestCase {
$this->userManager->expects($this->once())
->method('checkPasswordNoLogging')
->will($this->returnValue(false));
+ $this->userManager->expects($this->once())
+ ->method('getByEmail')
+ ->with($user)
+ ->willReturn([]);
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.login.showLoginForm', [
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index d7098aafcc2..ef419e40b40 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -261,6 +261,10 @@ class LostControllerTest extends \Test\TestCase {
array(false, $nonExistingUser)
)));
+ $this->userManager
+ ->method('getByEmail')
+ ->willReturn([]);
+
// With a non existing user
$response = $this->lostController->email($nonExistingUser);
$expectedResponse = new JSONResponse([
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index 5e6301d689a..bc95a9004f8 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -352,7 +352,7 @@ class CacheTest extends \Test\TestCase {
$id4 = $this->cache->put($file4, $fileData['foo2']);
$id5 = $this->cache->put($file5, $fileData['foo3']);
- $tagManager = \OC::$server->getTagManager()->load('files', null, null, $userId);
+ $tagManager = \OC::$server->getTagManager()->load('files', [], false, $userId);
$this->assertTrue($tagManager->tagAs($id1, 'tag1'));
$this->assertTrue($tagManager->tagAs($id1, 'tag2'));
$this->assertTrue($tagManager->tagAs($id2, 'tag2'));
@@ -422,7 +422,7 @@ class CacheTest extends \Test\TestCase {
$id4 = $this->cache->put($file4, $fileData['foo2']);
$id5 = $this->cache->put($file5, $fileData['foo3']);
- $tagManager = \OC::$server->getTagManager()->load('files', null, null, $userId);
+ $tagManager = \OC::$server->getTagManager()->load('files', [], false, $userId);
$this->assertTrue($tagManager->tagAs($id1, 'tag1'));
$this->assertTrue($tagManager->tagAs($id1, 'tag2'));
$this->assertTrue($tagManager->tagAs($id2, 'tag2'));
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index a66ff14a778..80d62b16578 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -173,8 +173,9 @@ class EncryptionTest extends Storage {
->method('get')
->willReturnCallback(function($path) {return ['encrypted' => false, 'path' => $path];});
- $this->mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
- ->disableOriginalConstructor()->getMock();
+ $this->mountManager = $this->createMock(\OC\Files\Mount\Manager::class);
+ $this->mountManager->method('findByStorageId')
+ ->willReturn([]);
$this->instance = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption')
->setConstructorArgs(
diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php
index f30bbdf7d11..6f3ed5ce318 100644
--- a/tests/lib/Repair/RepairMimeTypesTest.php
+++ b/tests/lib/Repair/RepairMimeTypesTest.php
@@ -54,16 +54,22 @@ class RepairMimeTypesTest extends \Test\TestCase {
protected function tearDown() {
$this->storage->getCache()->clear();
- $sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
- \OC_DB::executeAudited($sql, [$this->storage->getId()]);
+
+ $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $qb->delete('storages')
+ ->where($qb->expr()->eq('id', $qb->createNamedParameter($this->storage->getId())));
+ $qb->execute();
+
$this->clearMimeTypes();
parent::tearDown();
}
private function clearMimeTypes() {
- $sql = 'DELETE FROM `*PREFIX*mimetypes`';
- \OC_DB::executeAudited($sql);
+ $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
+ $qb->delete('mimetypes');
+ $qb->execute();
+
$this->mimetypeLoader->reset();
}
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index fcff4f64726..c4d29b979ae 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -434,6 +434,9 @@ class SessionTest extends \Test\TestCase {
->method('getSystemValue')
->with('token_auth_enforced', false)
->will($this->returnValue(false));
+ $manager->method('getByEmail')
+ ->with('unexist')
+ ->willReturn([]);
$this->assertFalse($userSession->logClientIn('unexist', 'doe', $request, $this->throttler));
}
@@ -1163,6 +1166,10 @@ class SessionTest extends \Test\TestCase {
->method('getTime')
->will($this->returnValue(100));
+ $manager->method('getByEmail')
+ ->with('john')
+ ->willReturn([]);
+
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
$this->assertEquals(10000, $token->getLastActivity());
@@ -1213,6 +1220,10 @@ class SessionTest extends \Test\TestCase {
->method('getTime')
->will($this->returnValue(100));
+ $manager->method('getByEmail')
+ ->with('john')
+ ->willReturn([]);
+
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
}