Remove some more at matchers in tests/lib

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/32901/head
Côme Chilliet 2 years ago
parent c7e1c36362
commit 6a1510f8ee
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
  1. 12
      tests/lib/DB/MigrationsTest.php
  2. 35
      tests/lib/Encryption/DecryptAllTest.php
  3. 30
      tests/lib/Encryption/Keys/StorageTest.php
  4. 20
      tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
  5. 55
      tests/lib/Files/ViewTest.php
  6. 168
      tests/lib/Http/Client/ClientTest.php
  7. 26
      tests/lib/InstallerTest.php
  8. 377
      tests/lib/IntegrityCheck/CheckerTest.php
  9. 32
      tests/lib/L10N/FactoryTest.php

@ -115,12 +115,12 @@ class MigrationsTest extends \Test\TestCase {
->willReturn($wrappedSchema);
$step = $this->createMock(IMigrationStep::class);
$step->expects($this->at(0))
$step->expects($this->once())
->method('preSchemaChange');
$step->expects($this->at(1))
$step->expects($this->once())
->method('changeSchema')
->willReturn($schemaResult);
$step->expects($this->at(2))
$step->expects($this->once())
->method('postSchemaChange');
$this->migrationService = $this->getMockBuilder(MigrationService::class)
@ -145,12 +145,12 @@ class MigrationsTest extends \Test\TestCase {
->method('migrateToSchema');
$step = $this->createMock(IMigrationStep::class);
$step->expects($this->at(0))
$step->expects($this->once())
->method('preSchemaChange');
$step->expects($this->at(1))
$step->expects($this->once())
->method('changeSchema')
->willReturn(null);
$step->expects($this->at(2))
$step->expects($this->once())
->method('postSchemaChange');
$this->migrationService = $this->getMockBuilder(MigrationService::class)

@ -224,12 +224,12 @@ class DecryptAllTest extends TestCase {
$this->userInterface->expects($this->any())
->method('getUsers')
->willReturn(['user1', 'user2']);
$instance->expects($this->at(0))
$instance->expects($this->exactly(2))
->method('decryptUsersFiles')
->with('user1');
$instance->expects($this->at(1))
->method('decryptUsersFiles')
->with('user2');
->withConsecutive(
['user1'],
['user2'],
);
} else {
$instance->expects($this->once())
->method('decryptUsersFiles')
@ -269,17 +269,18 @@ class DecryptAllTest extends TestCase {
$sharedStorage->expects($this->once())->method('instanceOfStorage')
->with('OCA\Files_Sharing\SharedStorage')->willReturn(true);
$this->view->expects($this->at(0))->method('getDirectoryContent')
->with('/user1/files')->willReturn(
$this->view->expects($this->exactly(2))
->method('getDirectoryContent')
->withConsecutive(
['/user1/files'],
['/user1/files/foo']
)
->willReturnOnConsecutiveCalls(
[
new FileInfo('path', $storage, 'intPath', ['name' => 'foo', 'type' => 'dir'], null),
new FileInfo('path', $storage, 'intPath', ['name' => 'bar', 'type' => 'file', 'encrypted' => true], null),
new FileInfo('path', $sharedStorage, 'intPath', ['name' => 'shared', 'type' => 'file', 'encrypted' => true], null),
]
);
$this->view->expects($this->at(3))->method('getDirectoryContent')
->with('/user1/files/foo')->willReturn(
],
[
new FileInfo('path', $storage, 'intPath', ['name' => 'subfile', 'type' => 'file', 'encrypted' => true], null)
]
@ -295,12 +296,12 @@ class DecryptAllTest extends TestCase {
}
);
$instance->expects($this->at(0))
->method('decryptFile')
->with('/user1/files/bar');
$instance->expects($this->at(1))
$instance->expects($this->exactly(2))
->method('decryptFile')
->with('/user1/files/foo/subfile');
->withConsecutive(
['/user1/files/bar'],
['/user1/files/foo/subfile'],
);
/* We need format method to return a string */

@ -162,27 +162,32 @@ class StorageTest extends TestCase {
->method('isSystemWideMountPoint')
->willReturn(false);
$this->view->expects($this->at(0))
->method('file_exists')
->with($this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey'))
->willReturn($originalKeyExists);
$this->crypto->method('decrypt')
->willReturnCallback(function ($data, $pass) {
return $data;
});
if (!$originalKeyExists) {
$this->view->expects($this->at(1))
$this->view->expects($this->exactly(2))
->method('file_exists')
->with($this->equalTo('/user1/files_encryption/keys' . $path . '/encModule/fileKey'))
->willReturn(true);
->withConsecutive(
[$this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey')],
[$this->equalTo('/user1/files_encryption/keys' . $path . '/encModule/fileKey')],
)->willReturnOnConsecutiveCalls(
$originalKeyExists,
true,
);
$this->view->expects($this->once())
->method('file_get_contents')
->with($this->equalTo('/user1/files_encryption/keys' . $path . '/encModule/fileKey'))
->willReturn(json_encode(['key' => base64_encode('key2')]));
} else {
$this->view->expects($this->once())
->method('file_exists')
->with($this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey'))
->willReturn($originalKeyExists);
$this->view->expects($this->once())
->method('file_get_contents')
->with($this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey'))
@ -627,10 +632,11 @@ class StorageTest extends TestCase {
->with('user1/files_encryption/backup')->willReturn(!$createBackupDir);
if ($createBackupDir) {
$this->view->expects($this->at(1))->method('mkdir')
->with('user1/files_encryption/backup');
$this->view->expects($this->at(2))->method('mkdir')
->with('user1/files_encryption/backup/test.encryptionModule.1234567');
$this->view->expects($this->exactly(2))->method('mkdir')
->withConsecutive(
['user1/files_encryption/backup'],
['user1/files_encryption/backup/test.encryptionModule.1234567'],
);
} else {
$this->view->expects($this->once())->method('mkdir')
->with('user1/files_encryption/backup/test.encryptionModule.1234567');

@ -201,17 +201,17 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
}
public function testMultiBucketConfigFirstFallBackSingle() {
$this->config->expects($this->at(0))
->method('getSystemValue')
->with($this->equalTo('objectstore_multibucket'))
->willReturn('');
$this->config->expects($this->at(1))
$this->config->expects($this->exactly(2))
->method('getSystemValue')
->with($this->equalTo('objectstore'))
->willReturn([
'class' => 'Test\Files\Mount\FakeObjectStore',
]);
->withConsecutive(
[$this->equalTo('objectstore_multibucket')],
[$this->equalTo('objectstore')],
)->willReturnOnConsecutiveCalls(
'',
[
'class' => 'Test\Files\Mount\FakeObjectStore',
],
);
$this->user->method('getUID')
->willReturn('uid');

@ -2643,44 +2643,31 @@ class ViewTest extends \Test\TestCase {
])
->getMock();
$view
->expects($this->at(0))
->method('is_file')
->with('/new')
->willReturn(false);
$view
->expects($this->at(1))
->method('file_exists')
->with('/new')
->willReturn(true);
$view
->expects($this->at(2))
->method('is_file')
->with('/new/folder')
->willReturn(false);
$view
->expects($this->at(3))
->method('file_exists')
->with('/new/folder')
->willReturn(false);
$view
->expects($this->at(4))
->method('mkdir')
->with('/new/folder');
$view
->expects($this->at(5))
$view->expects($this->exactly(3))
->method('is_file')
->with('/new/folder/structure')
->withConsecutive(
['/new'],
['/new/folder'],
['/new/folder/structure'],
)
->willReturn(false);
$view
->expects($this->at(6))
$view->expects($this->exactly(3))
->method('file_exists')
->with('/new/folder/structure')
->willReturn(false);
$view
->expects($this->at(7))
->withConsecutive(
['/new'],
['/new/folder'],
['/new/folder/structure'],
)->willReturnOnConsecutiveCalls(
true,
false,
false,
);
$view->expects($this->exactly(2))
->method('mkdir')
->with('/new/folder/structure');
->withConsecutive(
['/new/folder'],
['/new/folder/structure'],
);
$this->assertTrue(self::invokePrivate($view, 'createParentDirectories', ['/new/folder/structure']));
}

@ -75,35 +75,33 @@ class ClientTest extends \Test\TestCase {
public function testGetProxyUriProxyHostWithPassword(): void {
$this->config
->expects($this->at(0))
->expects($this->exactly(3))
->method('getSystemValue')
->with(
$this->equalTo('proxy'),
$this->callback(function ($input) {
return $input === '';
})
->withConsecutive(
[
$this->equalTo('proxy'),
$this->callback(function ($input) {
return $input === '';
})
],
[
$this->equalTo('proxyuserpwd'),
$this->callback(function ($input) {
return $input === '';
})
],
[
$this->equalTo('proxyexclude'),
$this->callback(function ($input) {
return $input === [];
})
],
)
->willReturn('foo');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with(
$this->equalTo('proxyuserpwd'),
$this->callback(function ($input) {
return $input === '';
})
)
->willReturn('username:password');
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with(
$this->equalTo('proxyexclude'),
$this->callback(function ($input) {
return $input === [];
})
)
->willReturn([]);
->willReturnOnConsecutiveCalls(
'foo',
'username:password',
[],
);
$this->assertEquals([
'http' => 'username:password@foo',
'https' => 'username:password@foo'
@ -112,35 +110,33 @@ class ClientTest extends \Test\TestCase {
public function testGetProxyUriProxyHostWithPasswordAndExclude(): void {
$this->config
->expects($this->at(0))
->method('getSystemValue')
->with(
$this->equalTo('proxy'),
$this->callback(function ($input) {
return $input === '';
})
)
->willReturn('foo');
$this->config
->expects($this->at(1))
->expects($this->exactly(3))
->method('getSystemValue')
->with(
$this->equalTo('proxyuserpwd'),
$this->callback(function ($input) {
return $input === '';
})
->withConsecutive(
[
$this->equalTo('proxy'),
$this->callback(function ($input) {
return $input === '';
})
],
[
$this->equalTo('proxyuserpwd'),
$this->callback(function ($input) {
return $input === '';
})
],
[
$this->equalTo('proxyexclude'),
$this->callback(function ($input) {
return $input === [];
})
],
)
->willReturn('username:password');
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with(
$this->equalTo('proxyexclude'),
$this->callback(function ($input) {
return $input === [];
})
)
->willReturn(['bar']);
->willReturnOnConsecutiveCalls(
'foo',
'username:password',
['bar'],
);
$this->assertEquals([
'http' => 'username:password@foo',
'https' => 'username:password@foo',
@ -469,10 +465,16 @@ class ClientTest extends \Test\TestCase {
public function testSetDefaultOptionsWithNotInstalled(): void {
$this->config
->expects($this->at(1))
->expects($this->exactly(2))
->method('getSystemValue')
->with('installed', false)
->willReturn(false);
->withConsecutive(
['proxy', ''],
['installed', false],
)
->willReturnOnConsecutiveCalls(
'',
false,
);
$this->certificateManager
->expects($this->never())
->method('listCertificates');
@ -500,20 +502,20 @@ class ClientTest extends \Test\TestCase {
public function testSetDefaultOptionsWithProxy(): void {
$this->config
->expects($this->at(0))
->expects($this->exactly(4))
->method('getSystemValue')
->with('proxy', null)
->willReturn('foo');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('proxyuserpwd', null)
->willReturn(null);
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with('proxyexclude', [])
->willReturn([]);
->withConsecutive(
['proxy', ''],
['proxyuserpwd', ''],
['proxyexclude', []],
['installed', false],
)
->willReturnOnConsecutiveCalls(
'foo',
'',
[],
true,
);
$this->certificateManager
->expects($this->once())
->method('getAbsoluteBundlePath')
@ -547,20 +549,20 @@ class ClientTest extends \Test\TestCase {
public function testSetDefaultOptionsWithProxyAndExclude(): void {
$this->config
->expects($this->at(0))
->expects($this->exactly(4))
->method('getSystemValue')
->with('proxy', null)
->willReturn('foo');
$this->config
->expects($this->at(1))
->method('getSystemValue')
->with('proxyuserpwd', null)
->willReturn(null);
$this->config
->expects($this->at(2))
->method('getSystemValue')
->with('proxyexclude', [])
->willReturn(['bar']);
->withConsecutive(
['proxy', ''],
['proxyuserpwd', ''],
['proxyexclude', []],
['installed', false],
)
->willReturnOnConsecutiveCalls(
'foo',
'',
['bar'],
true,
);
$this->certificateManager
->expects($this->once())
->method('getAbsoluteBundlePath')

@ -340,7 +340,7 @@ u/spPSSVhaun5BA1FlphB2TkgnzlCmxJa63nFY045e/Jq+IKMcqqZl/092gbI2EQ
$realTmpFile = \OC::$server->getTempManager()->getTemporaryFile('.tar.gz');
copy(__DIR__ . '/../data/testapp.tar.gz', $realTmpFile);
$this->tempManager
->expects($this->at(0))
->expects($this->once())
->method('getTemporaryFile')
->with('.tar.gz')
->willReturn($realTmpFile);
@ -418,14 +418,14 @@ YwDVP+QmNRzx72jtqAN/Kc3CvQ9nkgYhU65B95aX0xA=',
$realTmpFile = \OC::$server->getTempManager()->getTemporaryFile('.tar.gz');
copy(__DIR__ . '/../data/testapp1.tar.gz', $realTmpFile);
$this->tempManager
->expects($this->at(0))
->expects($this->once())
->method('getTemporaryFile')
->with('.tar.gz')
->willReturn($realTmpFile);
$realTmpFolder = \OC::$server->getTempManager()->getTemporaryFolder();
mkdir($realTmpFolder . '/testfolder');
$this->tempManager
->expects($this->at(1))
->expects($this->once())
->method('getTemporaryFolder')
->willReturn($realTmpFolder);
$client = $this->createMock(IClient::class);
@ -502,13 +502,13 @@ YwDVP+QmNRzx72jtqAN/Kc3CvQ9nkgYhU65B95aX0xA=',
$realTmpFile = \OC::$server->getTempManager()->getTemporaryFile('.tar.gz');
copy(__DIR__ . '/../data/testapp1.tar.gz', $realTmpFile);
$this->tempManager
->expects($this->at(0))
->expects($this->once())
->method('getTemporaryFile')
->with('.tar.gz')
->willReturn($realTmpFile);
$realTmpFolder = \OC::$server->getTempManager()->getTemporaryFolder();
$this->tempManager
->expects($this->at(1))
->expects($this->once())
->method('getTemporaryFolder')
->willReturn($realTmpFolder);
$client = $this->createMock(IClient::class);
@ -575,30 +575,30 @@ MPLX6f5V9tCJtlH6ztmEcDROfvuVc0U3rEhqx2hphoyo+MZrPFpdcJL8KkIdMKbY
],
];
$this->appFetcher
->expects($this->at(0))
->expects($this->atLeastOnce())
->method('get')
->willReturn($appArray);
->willReturnOnConsecutiveCalls($appArray);
$realTmpFile = \OC::$server->getTempManager()->getTemporaryFile('.tar.gz');
copy(__DIR__ . '/../data/testapp.tar.gz', $realTmpFile);
$this->tempManager
->expects($this->at(0))
->expects($this->atLeastOnce())
->method('getTemporaryFile')
->with('.tar.gz')
->willReturn($realTmpFile);
->willReturnOnConsecutiveCalls($realTmpFile);
$realTmpFolder = \OC::$server->getTempManager()->getTemporaryFolder();
$this->tempManager
->expects($this->at(1))
->expects($this->atLeastOnce())
->method('getTemporaryFolder')
->willReturn($realTmpFolder);
->willReturnOnConsecutiveCalls($realTmpFolder);
$client = $this->createMock(IClient::class);
$client
->expects($this->once())
->method('get')
->with('https://example.com', ['sink' => $realTmpFile, 'timeout' => 120]);
$this->clientService
->expects($this->at(0))
->expects($this->atLeastOnce())
->method('newClient')
->willReturn($client);
->willReturnOnConsecutiveCalls($client);
$installer = $this->getInstaller();
$installer->downloadApp('testapp');

@ -88,12 +88,12 @@ class CheckerTest extends TestCase {
$this->expectExceptionMessage('Exception message');
$this->fileAccessHelper
->expects($this->at(0))
->expects($this->once())
->method('assertDirectoryExists')
->with('NotExistingApp/appinfo')
->willThrowException(new \Exception('Exception message'));
$this->fileAccessHelper
->expects($this->at(1))
->expects($this->once())
->method('is_writable')
->with('NotExistingApp/appinfo')
->willReturn(true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NAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'],
['/resources/codesigning/root.crt'],
)
->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
@ -244,19 +241,16 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEwTCCAqmgAwIBAgIUWv0iujufs5lUr0svCf\/qTQvoyKAwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIyNDk1M1oXDTE2MTEwMzIyNDk1M1owEjEQMA4GA1UEAwwHU29tZUFwcDCCAiIw\r\nDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK8q0x62agGSRBqeWsaeEwFfepMk\r\nF8cAobMMi50qHCv9IrOn\/ZH9l52xBrbIkErVmRjmly0d4JhD8Ymhidsh9ONKYl\/j\r\n+ishsZDM8eNNdp3Ew+fEYVvY1W7mR1qU24NWj0bzVsClI7hvPVIuw7AjfBDq1C5+\r\nA+ZSLSXYvOK2cEWjdxQfuNZwEZSjmA63DUllBIrm35IaTvfuyhU6BW9yHZxmb8+M\r\nw0xDv30D5UkE\/2N7Pa\/HQJLxCR+3zKibRK3nUyRDLSXxMkU9PnFNaPNX59VPgyj4\r\nGB1CFSToldJVPF4pzh7p36uGXZVxs8m3LFD4Ol8mhi7jkxDZjqFN46gzR0r23Py6\r\ndol9vfawGIoUwp9LvL0S7MvdRY0oazLXwClLP4OQ17zpSMAiCj7fgNT661JamPGj\r\nt5O7Zn2wA7I4ddDS\/HDTWCu98Zwc9fHIpsJPgCZ9awoqxi4Mnf7Pk9g5nnXhszGC\r\ncxxIASQKM+GhdzoRxKknax2RzUCwCzcPRtCj8AQT\/x\/mqN3PfRmlnFBNACUw9bpZ\r\nSOoNq2pCF9igftDWpSIXQ38pVpKLWowjjg3DVRmVKBgivHnUnVLyzYBahHPj0vaz\r\ntFtUFRaqXDnt+4qyUGyrT5h5pjZaTcHIcSB4PiarYwdVvgslgwnQzOUcGAzRWBD4\r\n6jV2brP5vFY3g6iPAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBACTY3CCHC+Z28gCf\r\nFWGKQ3wAKs+k4+0yoti0qm2EKX7rSGQ0PHSas6uW79WstC4Rj+DYkDtIhGMSg8FS\r\nHVGZHGBCc0HwdX+BOAt3zi4p7Sf3oQef70\/4imPoKxbAVCpd\/cveVcFyDC19j1yB\r\nBapwu87oh+muoeaZxOlqQI4UxjBlR\/uRSMhOn2UGauIr3dWJgAF4pGt7TtIzt+1v\r\n0uA6FtN1Y4R5O8AaJPh1bIG0CVvFBE58esGzjEYLhOydgKFnEP94kVPgJD5ds9C3\r\npPhEpo1dRpiXaF7WGIV1X6DI\/ipWvfrF7CEy6I\/kP1InY\/vMDjQjeDnJ\/VrXIWXO\r\nyZvHXVaN\/m+1RlETsH7YO\/QmxRue9ZHN3gvvWtmpCeA95sfpepOk7UcHxHZYyQbF\r\n49\/au8j+5tsr4A83xzsT1JbcKRxkAaQ7WDJpOnE5O1+H0fB+BaLakTg6XX9d4Fo7\r\n7Gin7hVWX7pL+JIyxMzME3LhfI61+CRcqZQIrpyaafUziPQbWIPfEs7h8tCOWyvW\r\nUO8ZLervYCB3j44ivkrxPlcBklDCqqKKBzDP9dYOtS\/P4RB1NkHA9+NTvmBpTonS\r\nSFXdg9fFMD7VfjDE3Vnk+8DWkVH5wBYowTAD7w9Wuzr7DumiAULexnP\/Y7xwxLv7\r\n4B+pXTAcRK0zECDEaX3npS8xWzrB\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'],
['/resources/codesigning/root.crt'],
)
->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$expected = [
'EXCEPTION' => [
@ -292,19 +286,16 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'],
['/resources/codesigning/root.crt'],
)
->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$expected = [
@ -355,19 +346,16 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9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
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'],
['/resources/codesigning/root.crt'],
)
->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$expected = [
@ -419,17 +407,15 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIExjCCAq6gAwIBAgIUHSJjhJqMwr+3TkoiQFg4SVVYQ1gwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIzMjc1NVoXDTE2MTEwMzIzMjc1NVowFzEVMBMGA1UEAwwMQW5vdGhlclNjb3Bl\r\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA33npb5RmUkXrDT+TbwMf\r\n0zQ33SlzsjoGxCrbSwJOn6leGGInJ6ZrdzLL0WTi\/dTpg+Y\/JS+72XWm5NSjaTxo\r\n7OHc3cQBwXQj4tN6j\/y5qqY0GDLYufEkx2rpazqt9lBSJ72u1bGl2yoOXzYCz5i0\r\n60KsJXC9K44LKzGsarzbwAgskSVNkjAsPgjnCWZmcl6icpLi5Fz9rs2UMOWbdvdI\r\nAROsn0eC9E\/akmXTy5YMu6bAIGpvjZFHzyA83FQRbvv5o1V5Gsye\/VQLEgh7rqfz\r\nT\/jgWifP+JgoeB6otzuRZ3fFsmbBiyCIRtIOzQQflozhUlWtmiEGwg4GySuMUjEH\r\nA1LF86LO+ZzDQgd2oY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/pKo+CMj1VzjNT\r\nD8YRQg0cjmDytJzHDrtV\/aTc9W1aPHun0vw=\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json')
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json'],
['/resources/codesigning/root.crt'],
)->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$expected = [
'EXCEPTION' => [
@ -465,17 +451,15 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54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EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json')
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
'/resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'],
['/resources/codesigning/root.crt'],
)->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
@ -486,11 +470,11 @@ class CheckerTest extends TestCase {
$this->expectExceptionMessage('Exception message');
$this->fileAccessHelper
->expects($this->at(0))
->expects($this->once())
->method('assertDirectoryExists')
->will($this->throwException(new \Exception('Exception message')));
$this->fileAccessHelper
->expects($this->at(1))
->expects($this->once())
->method('is_writable')
->with(__DIR__ . '/core')
->willReturn(true);
@ -510,11 +494,11 @@ class CheckerTest extends TestCase {
$this->expectExceptionMessageMatches('/[a-zA-Z\\/_-]+ is not writable/');
$this->fileAccessHelper
->expects($this->at(0))
->expects($this->once())
->method('assertDirectoryExists')
->will($this->throwException(new \Exception('Exception message')));
$this->fileAccessHelper
->expects($this->at(1))
->expects($this->once())
->method('is_writable')
->with(__DIR__ . '/core')
->willReturn(false);
@ -707,19 +691,15 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rD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3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'],
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'],
)->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@ -748,19 +728,16 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->expects($this->exactly(2))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt'
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json'],
[\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt'],
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@ -841,19 +818,15 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\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->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'],
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'],
)->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$this->assertSame([], $this->checker->verifyCoreSignature());
}
@ -882,19 +855,15 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO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YKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json'],
[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'],
)->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$expected = [
'EXCEPTION' => [
@ -929,19 +898,15 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPx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Ycy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json'],
[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt'],
)->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$expected = [
'INVALID_HASH' => [
@ -991,19 +956,15 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUPYoweUxCPqbDW4ntuh7QvgyqSrgwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIyNDIwNloXDTE2MTEwMzIyNDIwNlowDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJui3nDbjOIjxNnthdBZplphujsN6u8K\r\nQ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KxyJ1gy2ZtxIJ2GyvLtSe8NUSqvfPWOaAKEUV2\r\ngniytnEFLr+PcD+9EGux6jZNuj6HmtWVThTfD5VGFmtlVU2z71ZRYY0kn6J3mmFc\r\nS2ecEcCUwqG5YNLncEUCyZhC2klWql2SHyGctCEyWWY7ikIDjVzYt2EbcFvLNBnP\r\ntybN1TYHRRZxlug00CCoOE9EZfk46FkZpDvU6KmqJRofkNZ5sj+SffyGcwYwNrDH\r\nKqe8m+9lHf3CRTIDeMu8r2xl1I6M6ZZfjabbmVP9Jd6WN4s6f1FlXDWzhlT1N0Qw\r\nGzJj6xB+SPtS3UV05tBlvbfA4e06D5G9uD7Q8ONcINtMS0xsSJ2oo82AqlpvlF\/q\r\noj7YKHsaTVGA+FxBktZHfoxD\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'],
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'],
)->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$expected = [
'EXCEPTION' => [
@ -1038,19 +999,15 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEwTCCAqmgAwIBAgIUWv0iujufs5lUr0svCf\/qTQvoyKAwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIyNDk1M1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7TtIzt+1v\r\n0uA6FtN1Y4R5O8AaJPh1bIG0CVvFBE58esGzjEYLhOydgKFnEP94kVPgJD5ds9C3\r\npPhEpo1dRpiXaF7WGIV1X6DI\/ipWvfrF7CEy6I\/kP1InY\/vMDjQjeDnJ\/VrXIWXO\r\nyZvHXVaN\/m+1RlETsH7YO\/QmxRue9ZHN3gvvWtmpCeA95sfpepOk7UcHxHZYyQbF\r\n49\/au8j+5tsr4A83xzsT1JbcKRxkAaQ7WDJpOnE5O1+H0fB+BaLakTg6XX9d4Fo7\r\n7Gin7hVWX7pL+JIyxMzME3LhfI61+CRcqZQIrpyaafUziPQbWIPfEs7h8tCOWyvW\r\nUO8ZLervYCB3j44ivkrxPlcBklDCqqKKBzDP9dYOtS\/P4RB1NkHA9+NTvmBpTonS\r\nSFXdg9fFMD7VfjDE3Vnk+8DWkVH5wBYowTAD7w9Wuzr7DumiAULexnP\/Y7xwxLv7\r\n4B+pXTAcRK0zECDEaX3npS8xWzrB\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
->expects($this->at(0))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'
)
->willReturn($signatureDataFile);
$this->fileAccessHelper
->expects($this->at(1))
->method('file_get_contents')
->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'
)
->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'));
->expects($this->exactly(2))
->method('file_get_contents')
->withConsecutive(
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json'],
[\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt'],
)->willReturnOnConsecutiveCalls(
$signatureDataFile,
file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')
);
$expected = [
'EXCEPTION' => [
@ -1079,10 +1036,10 @@ class CheckerTest extends TestCase {
->getMock();
$this->checker
->expects($this->at(0))
->expects($this->once())
->method('verifyCoreSignature');
$this->appLocator
->expects($this->at(0))
->expects($this->once())
->method('getAllApps')
->willReturn([
'files',
@ -1091,57 +1048,47 @@ class CheckerTest extends TestCase {
'dav',
]);
$this->appManager
->expects($this->at(0))
->expects($this->exactly(4))
->method('isShipped')
->with('files')
->willReturn(true);
->withConsecutive(
['files'],
['calendar'],
['contacts'],
['dav'],
)->willReturnOnConsecutiveCalls(
true,
false,
false,
true,
);
$this->checker
->expects($this->at(1))
->expects($this->exactly(3))
->method('verifyAppSignature')
->with('files');
$this->appManager
->expects($this->at(1))
->method('isShipped')
->with('calendar')
->willReturn(false);
->withConsecutive(
['files'],
['calendar'],
['dav'],
);
$this->appLocator
->expects($this->at(1))
->expects($this->exactly(2))
->method('getAppPath')
->with('calendar')
->willReturn('/apps/calendar');
->withConsecutive(
['calendar'],
['contacts'],
)->willReturnOnConsecutiveCalls(
'/apps/calendar',
'/apps/contacts',
);
$this->fileAccessHelper
->expects($this->at(0))
->expects($this->exactly(2))
->method('file_exists')
->with('/apps/calendar/appinfo/signature.json')
->willReturn(true);
$this->checker
->expects($this->at(2))
->method('verifyAppSignature')
->with('calendar');
$this->appManager
->expects($this->at(2))
->method('isShipped')
->with('contacts')
->willReturn(false);
$this->appLocator
->expects($this->at(2))
->method('getAppPath')
->with('contacts')
->willReturn('/apps/contacts');
$this->fileAccessHelper
->expects($this->at(1))
->method('file_exists')
->with('/apps/contacts/appinfo/signature.json')
->willReturn(false);
$this->appManager
->expects($this->at(3))
->method('isShipped')
->with('dav')
->willReturn(true);
$this->checker
->expects($this->at(3))
->method('verifyAppSignature')
->with('dav');
->withConsecutive(
['/apps/calendar/appinfo/signature.json'],
['/apps/contacts/appinfo/signature.json'],
)->willReturnOnConsecutiveCalls(
true,
false,
);
$this->config
->expects($this->once())
->method('deleteAppValue')

@ -105,20 +105,26 @@ class FactoryTest extends TestCase {
public function testFindLanguageWithNotExistingRequestLanguageAndExistingStoredUserLanguage(): void {
$factory = $this->getFactory(['languageExists']);
$this->invokePrivate($factory, 'requestLanguage', ['de']);
$factory->expects(self::at(0))
$factory->expects($this->exactly(2))
->method('languageExists')
->with('MyApp', 'de')
->willReturn(false);
->withConsecutive(
['MyApp', 'de'],
['MyApp', 'jp'],
)
->willReturnOnConsecutiveCalls(
false,
true,
);
$this->config
->expects(self::at(0))
->expects($this->exactly(2))
->method('getSystemValue')
->with('force_language', false)
->willReturn(false);
$this->config
->expects(self::at(1))
->method('getSystemValue')
->with('installed', false)
->willReturn(true);
->withConsecutive(
['force_language', false],
['installed', false],
)->willReturnOnConsecutiveCalls(
false,
true,
);
$user = $this->getMockBuilder(IUser::class)
->getMock();
$user->expects(self::once())
@ -133,10 +139,6 @@ class FactoryTest extends TestCase {
->method('getUserValue')
->with('MyUserUid', 'core', 'lang', null)
->willReturn('jp');
$factory->expects(self::at(1))
->method('languageExists')
->with('MyApp', 'jp')
->willReturn(true);
self::assertSame('jp', $factory->findLanguage('MyApp'));
}

Loading…
Cancel
Save