Merge pull request #5791 from nextcloud/add-php7.2-tests

[CI] Add PHP 7.2 testing container
This commit is contained in:
Morris Jobke 2017-08-09 22:08:02 +02:00 committed by GitHub
commit 3b955a1625
16 changed files with 81 additions and 21 deletions

View File

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

View File

@ -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');
}

View File

@ -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' => [],
)
);
}

View File

@ -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() {

View File

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

View File

@ -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);
}

View File

@ -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');
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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', [

View File

@ -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([

View File

@ -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'));

View File

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

View File

@ -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();
}

View File

@ -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);
}