Merge pull request #5791 from nextcloud/add-php7.2-tests
[CI] Add PHP 7.2 testing container
This commit is contained in:
commit
3b955a1625
22
.drone.yml
22
.drone.yml
|
@ -171,6 +171,14 @@ pipeline:
|
||||||
matrix:
|
matrix:
|
||||||
DB: NODB
|
DB: NODB
|
||||||
PHP: 7.1
|
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:
|
sqlite-php5.6:
|
||||||
image: nextcloudci/php5.6:php5.6-7
|
image: nextcloudci/php5.6:php5.6-7
|
||||||
commands:
|
commands:
|
||||||
|
@ -195,6 +203,14 @@ pipeline:
|
||||||
matrix:
|
matrix:
|
||||||
DB: sqlite
|
DB: sqlite
|
||||||
PHP: 7.1
|
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:
|
mysql-php5.6:
|
||||||
image: nextcloudci/php5.6:php5.6-7
|
image: nextcloudci/php5.6:php5.6-7
|
||||||
commands:
|
commands:
|
||||||
|
@ -599,6 +615,9 @@ matrix:
|
||||||
- DB: NODB
|
- DB: NODB
|
||||||
PHP: 7.1
|
PHP: 7.1
|
||||||
ENABLE_REDIS: true
|
ENABLE_REDIS: true
|
||||||
|
- DB: NODB
|
||||||
|
PHP: 7.2
|
||||||
|
ENABLE_REDIS: false
|
||||||
- DB: sqlite
|
- DB: sqlite
|
||||||
PHP: 5.6
|
PHP: 5.6
|
||||||
ENABLE_REDIS: true
|
ENABLE_REDIS: true
|
||||||
|
@ -608,6 +627,9 @@ matrix:
|
||||||
- DB: sqlite
|
- DB: sqlite
|
||||||
PHP: 7.1
|
PHP: 7.1
|
||||||
ENABLE_REDIS: true
|
ENABLE_REDIS: true
|
||||||
|
- DB: sqlite
|
||||||
|
PHP: 7.2
|
||||||
|
ENABLE_REDIS: false
|
||||||
- DB: mysql
|
- DB: mysql
|
||||||
PHP: 5.6
|
PHP: 5.6
|
||||||
ENABLE_REDIS: true
|
ENABLE_REDIS: true
|
||||||
|
|
|
@ -243,7 +243,7 @@ class CacheTest extends TestCase {
|
||||||
$id2 = $this->sharedCache->get('subdir/another too.txt')['fileid'];
|
$id2 = $this->sharedCache->get('subdir/another too.txt')['fileid'];
|
||||||
$id3 = $this->sharedCache->get('subdir/not a text file.xml')['fileid'];
|
$id3 = $this->sharedCache->get('subdir/not a text file.xml')['fileid'];
|
||||||
$id4 = $this->sharedCache->get('subdir/another.txt')['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, 'tag1');
|
||||||
$tagManager->tagAs($id1, 'tag2');
|
$tagManager->tagAs($id1, 'tag2');
|
||||||
$tagManager->tagAs($id2, 'tag1');
|
$tagManager->tagAs($id2, 'tag1');
|
||||||
|
@ -285,7 +285,7 @@ class CacheTest extends TestCase {
|
||||||
$this->sharedCache->get('subdir/emptydir')['fileid'],
|
$this->sharedCache->get('subdir/emptydir')['fileid'],
|
||||||
$this->sharedCache->get('subdir/emptydir2')['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) {
|
foreach ($allIds as $id) {
|
||||||
$tagManager->tagAs($id, 'tag1');
|
$tagManager->tagAs($id, 'tag1');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1269,6 +1269,7 @@ class UserTest extends \Test\TestCase {
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
'pwdchangedtime' => array((new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'),
|
'pwdchangedtime' => array((new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'),
|
||||||
|
'pwdgraceusetime' => [],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1342,6 +1343,7 @@ class UserTest extends \Test\TestCase {
|
||||||
array(
|
array(
|
||||||
'pwdpolicysubentry' => array('cn=custom,ou=policies,dc=foo,dc=bar'),
|
'pwdpolicysubentry' => array('cn=custom,ou=policies,dc=foo,dc=bar'),
|
||||||
'pwdchangedtime' => array((new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'),
|
'pwdchangedtime' => array((new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'),
|
||||||
|
'pwdgraceusetime' => [],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,9 @@ class User_LDAPTest extends TestCase {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
$access->method('fetchUsersByLoginName')
|
||||||
|
->willReturn([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -353,6 +356,9 @@ class User_LDAPTest extends TestCase {
|
||||||
$access->expects($this->any())
|
$access->expects($this->any())
|
||||||
->method('nextcloudUserNames')
|
->method('nextcloudUserNames')
|
||||||
->will($this->returnArgument(0));
|
->will($this->returnArgument(0));
|
||||||
|
|
||||||
|
$access->method('fetchUsersByLoginName')
|
||||||
|
->willReturn([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetUsersNoParam() {
|
public function testGetUsersNoParam() {
|
||||||
|
@ -760,6 +766,9 @@ class User_LDAPTest extends TestCase {
|
||||||
$access->expects($this->any())
|
$access->expects($this->any())
|
||||||
->method('getUserMapper')
|
->method('getUserMapper')
|
||||||
->will($this->returnValue($userMapper));
|
->will($this->returnValue($userMapper));
|
||||||
|
|
||||||
|
$access->method('fetchUsersByLoginName')
|
||||||
|
->willReturn([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetDisplayName() {
|
public function testGetDisplayName() {
|
||||||
|
|
|
@ -432,7 +432,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
||||||
// 'application/json' must be decoded manually.
|
// 'application/json' must be decoded manually.
|
||||||
if (strpos($this->getHeader('Content-Type'), 'application/json') !== false) {
|
if (strpos($this->getHeader('Content-Type'), 'application/json') !== false) {
|
||||||
$params = json_decode(file_get_contents($this->inputStream), true);
|
$params = json_decode(file_get_contents($this->inputStream), true);
|
||||||
if(count($params) > 0) {
|
if($params !== null && count($params) > 0) {
|
||||||
$this->items['params'] = $params;
|
$this->items['params'] = $params;
|
||||||
if($this->method === 'POST') {
|
if($this->method === 'POST') {
|
||||||
$this->items['post'] = $params;
|
$this->items['post'] = $params;
|
||||||
|
|
|
@ -184,7 +184,7 @@ class FailedStorage extends Common {
|
||||||
return true;
|
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);
|
throw new StorageNotAvailableException($this->e->getMessage(), $this->e->getCode(), $this->e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ class NullStorage extends Common {
|
||||||
return false;
|
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');
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ class Mailer implements IMailer {
|
||||||
}
|
}
|
||||||
|
|
||||||
list($name, $domain) = explode('@', $email, 2);
|
list($name, $domain) = explode('@', $email, 2);
|
||||||
$domain = idn_to_ascii($domain);
|
$domain = idn_to_ascii($domain, 0,INTL_IDNA_VARIANT_UTS46);
|
||||||
return $name.'@'.$domain;
|
return $name.'@'.$domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,11 @@ class Message {
|
||||||
foreach($addresses as $email => $readableName) {
|
foreach($addresses as $email => $readableName) {
|
||||||
if(!is_numeric($email)) {
|
if(!is_numeric($email)) {
|
||||||
list($name, $domain) = explode('@', $email, 2);
|
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;
|
$convertedAddresses[$name.'@'.$domain] = $readableName;
|
||||||
} else {
|
} else {
|
||||||
list($name, $domain) = explode('@', $readableName, 2);
|
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;
|
$convertedAddresses[$email] = $name.'@'.$domain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,11 +148,12 @@ class Route extends SymfonyRoute implements IRoute {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function actionInclude($file) {
|
public function actionInclude($file) {
|
||||||
$function = create_function('$param',
|
$function = function($param) use ($file) {
|
||||||
'unset($param["_route"]);'
|
unset($param["_route"]);
|
||||||
.'$_GET=array_merge($_GET, $param);'
|
$_GET=array_merge($_GET, $param);
|
||||||
.'unset($param);'
|
unset($param);
|
||||||
.'require_once "'.$file.'";');
|
require_once "'.$file.'";
|
||||||
|
} ;
|
||||||
$this->action($function);
|
$this->action($function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,6 +291,10 @@ class LoginControllerTest extends TestCase {
|
||||||
$this->userManager->expects($this->once())
|
$this->userManager->expects($this->once())
|
||||||
->method('checkPasswordNoLogging')
|
->method('checkPasswordNoLogging')
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
|
$this->userManager->expects($this->once())
|
||||||
|
->method('getByEmail')
|
||||||
|
->with($user)
|
||||||
|
->willReturn([]);
|
||||||
$this->urlGenerator->expects($this->once())
|
$this->urlGenerator->expects($this->once())
|
||||||
->method('linkToRoute')
|
->method('linkToRoute')
|
||||||
->with('core.login.showLoginForm', [
|
->with('core.login.showLoginForm', [
|
||||||
|
|
|
@ -261,6 +261,10 @@ class LostControllerTest extends \Test\TestCase {
|
||||||
array(false, $nonExistingUser)
|
array(false, $nonExistingUser)
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
$this->userManager
|
||||||
|
->method('getByEmail')
|
||||||
|
->willReturn([]);
|
||||||
|
|
||||||
// With a non existing user
|
// With a non existing user
|
||||||
$response = $this->lostController->email($nonExistingUser);
|
$response = $this->lostController->email($nonExistingUser);
|
||||||
$expectedResponse = new JSONResponse([
|
$expectedResponse = new JSONResponse([
|
||||||
|
|
|
@ -352,7 +352,7 @@ class CacheTest extends \Test\TestCase {
|
||||||
$id4 = $this->cache->put($file4, $fileData['foo2']);
|
$id4 = $this->cache->put($file4, $fileData['foo2']);
|
||||||
$id5 = $this->cache->put($file5, $fileData['foo3']);
|
$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, 'tag1'));
|
||||||
$this->assertTrue($tagManager->tagAs($id1, 'tag2'));
|
$this->assertTrue($tagManager->tagAs($id1, 'tag2'));
|
||||||
$this->assertTrue($tagManager->tagAs($id2, 'tag2'));
|
$this->assertTrue($tagManager->tagAs($id2, 'tag2'));
|
||||||
|
@ -422,7 +422,7 @@ class CacheTest extends \Test\TestCase {
|
||||||
$id4 = $this->cache->put($file4, $fileData['foo2']);
|
$id4 = $this->cache->put($file4, $fileData['foo2']);
|
||||||
$id5 = $this->cache->put($file5, $fileData['foo3']);
|
$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, 'tag1'));
|
||||||
$this->assertTrue($tagManager->tagAs($id1, 'tag2'));
|
$this->assertTrue($tagManager->tagAs($id1, 'tag2'));
|
||||||
$this->assertTrue($tagManager->tagAs($id2, 'tag2'));
|
$this->assertTrue($tagManager->tagAs($id2, 'tag2'));
|
||||||
|
|
|
@ -173,8 +173,9 @@ class EncryptionTest extends Storage {
|
||||||
->method('get')
|
->method('get')
|
||||||
->willReturnCallback(function($path) {return ['encrypted' => false, 'path' => $path];});
|
->willReturnCallback(function($path) {return ['encrypted' => false, 'path' => $path];});
|
||||||
|
|
||||||
$this->mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
|
$this->mountManager = $this->createMock(\OC\Files\Mount\Manager::class);
|
||||||
->disableOriginalConstructor()->getMock();
|
$this->mountManager->method('findByStorageId')
|
||||||
|
->willReturn([]);
|
||||||
|
|
||||||
$this->instance = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption')
|
$this->instance = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption')
|
||||||
->setConstructorArgs(
|
->setConstructorArgs(
|
||||||
|
|
|
@ -54,16 +54,22 @@ class RepairMimeTypesTest extends \Test\TestCase {
|
||||||
|
|
||||||
protected function tearDown() {
|
protected function tearDown() {
|
||||||
$this->storage->getCache()->clear();
|
$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();
|
$this->clearMimeTypes();
|
||||||
|
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function clearMimeTypes() {
|
private function clearMimeTypes() {
|
||||||
$sql = 'DELETE FROM `*PREFIX*mimetypes`';
|
$qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
|
||||||
\OC_DB::executeAudited($sql);
|
$qb->delete('mimetypes');
|
||||||
|
$qb->execute();
|
||||||
|
|
||||||
$this->mimetypeLoader->reset();
|
$this->mimetypeLoader->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,6 +434,9 @@ class SessionTest extends \Test\TestCase {
|
||||||
->method('getSystemValue')
|
->method('getSystemValue')
|
||||||
->with('token_auth_enforced', false)
|
->with('token_auth_enforced', false)
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
|
$manager->method('getByEmail')
|
||||||
|
->with('unexist')
|
||||||
|
->willReturn([]);
|
||||||
|
|
||||||
$this->assertFalse($userSession->logClientIn('unexist', 'doe', $request, $this->throttler));
|
$this->assertFalse($userSession->logClientIn('unexist', 'doe', $request, $this->throttler));
|
||||||
}
|
}
|
||||||
|
@ -1163,6 +1166,10 @@ class SessionTest extends \Test\TestCase {
|
||||||
->method('getTime')
|
->method('getTime')
|
||||||
->will($this->returnValue(100));
|
->will($this->returnValue(100));
|
||||||
|
|
||||||
|
$manager->method('getByEmail')
|
||||||
|
->with('john')
|
||||||
|
->willReturn([]);
|
||||||
|
|
||||||
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
|
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
|
||||||
|
|
||||||
$this->assertEquals(10000, $token->getLastActivity());
|
$this->assertEquals(10000, $token->getLastActivity());
|
||||||
|
@ -1213,6 +1220,10 @@ class SessionTest extends \Test\TestCase {
|
||||||
->method('getTime')
|
->method('getTime')
|
||||||
->will($this->returnValue(100));
|
->will($this->returnValue(100));
|
||||||
|
|
||||||
|
$manager->method('getByEmail')
|
||||||
|
->with('john')
|
||||||
|
->willReturn([]);
|
||||||
|
|
||||||
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
|
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue