Merge pull request #36520 from nextcloud/backport/36500/stable23

[stable23] Skip failing avatar test with PHP 8.0
This commit is contained in:
Joas Schilling 2023-02-06 10:34:50 +01:00 committed by GitHub
commit 13218848e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 59 deletions

View file

@ -43,7 +43,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
- name: Set up Nextcloud

View file

@ -44,7 +44,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
- name: Set up Nextcloud
@ -93,7 +93,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
- name: Set up Nextcloud

View file

@ -39,7 +39,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
- name: Set up Nextcloud

View file

@ -27,6 +27,7 @@ declare(strict_types=1);
namespace OCA\AdminAudit\Tests\Actions;
use OCA\AdminAudit\Actions\Security;
use OCA\AdminAudit\AuditLogger;
use OCP\IUser;
use Psr\Log\LoggerInterface;
use Test\TestCase;

View file

@ -194,6 +194,8 @@ class CheckSetupControllerTest extends TestCase {
'hasFreeTypeSupport',
'hasMissingIndexes',
'hasMissingPrimaryKeys',
'isImagickEnabled',
'areWebauthnExtensionsEnabled',
'isSqliteUsed',
'isPHPMailerUsed',
'getAppDirsWithDifferentOwner',

View file

@ -29,6 +29,7 @@ declare(strict_types=1);
*/
namespace OCA\UpdateNotification\Tests\Settings;
use OC\User\Backend;
use OCA\UpdateNotification\Settings\Admin;
use OCA\UpdateNotification\UpdateChecker;
use OCP\AppFramework\Http\TemplateResponse;
@ -39,6 +40,8 @@ use OCP\IGroupManager;
use OCP\L10N\IFactory;
use OCP\L10N\ILanguageIterator;
use OCP\Support\Subscription\IRegistry;
use OCP\User\Backend\ICountUsersBackend;
use OCP\UserInterface;
use OCP\Util;
use Test\TestCase;
use OCP\IUserManager;
@ -77,11 +80,11 @@ class AdminTest extends TestCase {
$this->logger = $this->createMock(LoggerInterface::class);
$this->admin = new Admin(
$this->config,
$this->updateChecker,
$this->groupManager,
$this->dateTimeFormatter,
$this->l10nFactory,
$this->config,
$this->updateChecker,
$this->groupManager,
$this->dateTimeFormatter,
$this->l10nFactory,
$this->subscriptionRegistry,
$this->userManager,
$this->logger
@ -89,9 +92,9 @@ class AdminTest extends TestCase {
}
public function testGetFormWithUpdate() {
$backend1 = $this->createMock(UserInterface::class);
$backend2 = $this->createMock(UserInterface::class);
$backend3 = $this->createMock(UserInterface::class);
$backend1 = $this->createMock(CountUsersBackend::class);
$backend2 = $this->createMock(CountUsersBackend::class);
$backend3 = $this->createMock(CountUsersBackend::class);
$backend1
->expects($this->once())
->method('implementsActions')
@ -213,9 +216,9 @@ class AdminTest extends TestCase {
}
public function testGetFormWithUpdateAndChangedUpdateServer() {
$backend1 = $this->createMock(UserInterface::class);
$backend2 = $this->createMock(UserInterface::class);
$backend3 = $this->createMock(UserInterface::class);
$backend1 = $this->createMock(CountUsersBackend::class);
$backend2 = $this->createMock(CountUsersBackend::class);
$backend3 = $this->createMock(CountUsersBackend::class);
$backend1
->expects($this->once())
->method('implementsActions')
@ -337,9 +340,9 @@ class AdminTest extends TestCase {
}
public function testGetFormWithUpdateAndCustomersUpdateServer() {
$backend1 = $this->createMock(UserInterface::class);
$backend2 = $this->createMock(UserInterface::class);
$backend3 = $this->createMock(UserInterface::class);
$backend1 = $this->createMock(CountUsersBackend::class);
$backend2 = $this->createMock(CountUsersBackend::class);
$backend3 = $this->createMock(CountUsersBackend::class);
$backend1
->expects($this->once())
->method('implementsActions')
@ -543,3 +546,7 @@ class AdminTest extends TestCase {
$this->assertSame($expectation, $result);
}
}
abstract class CountUsersBackend implements UserInterface, ICountUsersBackend {
}

View file

@ -62,6 +62,10 @@ class GuestAvatarTest extends TestCase {
* @return void
*/
public function testGet() {
if (PHP_VERSION_ID >= 80000) {
$this->markTestSkipped('Character placement is off 1 pixel on PHP 8.0 so skipping the binary comparison');
}
$avatar = $this->guestAvatar->getFile(32);
self::assertInstanceOf(InMemoryFile::class, $avatar);
$expectedFile = file_get_contents(

View file

@ -4,8 +4,6 @@ namespace Test\Encryption;
use OC\Encryption\Util;
use OC\Files\View;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\Encryption\IEncryptionModule;
use OCP\IConfig;
use Test\TestCase;
@ -190,43 +188,4 @@ class UtilTest extends TestCase {
['/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'],
];
}
public function dataTestIsSystemWideMountPoint() {
return [
[false, 'non-matching mount point name', [], [], '/mp_another'],
[true, 'applicable to all', [], []],
[true, 'applicable to user directly', ['user1'], []],
[true, 'applicable to group directly', [], ['group1']],
[false, 'non-applicable to current user', ['user2'], []],
[false, 'non-applicable to current user\'s group', [], ['group2']],
[true, 'mount point without leading slash', [], [], 'mp'],
];
}
/**
* @dataProvider dataTestIsSystemWideMountPoint
*/
public function testIsSystemWideMountPoint($expectedResult, $expectationText, $applicableUsers, $applicableGroups, $mountPointName = '/mp') {
$this->groupManager->method('isInGroup')
->will($this->returnValueMap([
['user1', 'group1', true], // user is only in group1
['user1', 'group2', false],
]));
$storages = [];
$storageConfig = $this->createMock(StorageConfig::class);
$storageConfig->method('getMountPoint')->willReturn($mountPointName);
$storageConfig->method('getApplicableUsers')->willReturn($applicableUsers);
$storageConfig->method('getApplicableGroups')->willReturn($applicableGroups);
$storages[] = $storageConfig;
$storagesServiceMock = $this->createMock(GlobalStoragesService::class);
$storagesServiceMock->expects($this->atLeastOnce())->method('getAllStorages')
->willReturn($storages);
$this->overwriteService(GlobalStoragesService::class, $storagesServiceMock);
$this->assertEquals($expectedResult, $this->util->isSystemWideMountPoint('/files/mp', 'user1'), 'Test case: ' . $expectationText);
}
}