Browse Source

Remove at matchers from tests in:

* apps/oauth2
* tests/Test/Repair/Owncloud

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v25.0.0beta1
Côme Chilliet 1 year ago
parent
commit
539162ba8b
No account linked to committer's email address

+ 4
- 7
apps/oauth2/tests/Controller/SettingsControllerTest.php View File

@@ -72,15 +72,12 @@ class SettingsControllerTest extends TestCase {

public function testAddClient() {
$this->secureRandom
->expects($this->at(0))
->expects($this->exactly(2))
->method('generate')
->with(64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
->willReturn('MySecret');
$this->secureRandom
->expects($this->at(1))
->method('generate')
->with(64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
->willReturn('MyClientIdentifier');
->willReturnOnConsecutiveCalls(
'MySecret',
'MyClientIdentifier');

$client = new Client();
$client->setName('My Client Name');

+ 25
- 25
tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php View File

@@ -107,12 +107,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$this->equalTo(['uid' => 'myuid'])
);

$this->logger->expects($this->at(0))
$this->logger->expects($this->exactly(2))
->method('info')
->with($this->equalTo('Started preview cleanup for myuid'));
$this->logger->expects($this->at(1))
->method('info')
->with($this->equalTo('New preview cleanup scheduled for myuid'));
->withConsecutive(
[$this->equalTo('Started preview cleanup for myuid')],
[$this->equalTo('New preview cleanup scheduled for myuid')],
);

$this->job->run(['uid' => 'myuid']);
}
@@ -146,12 +146,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$this->jobList->expects($this->never())
->method('add');

$this->logger->expects($this->at(0))
->method('info')
->with($this->equalTo('Started preview cleanup for myuid'));
$this->logger->expects($this->at(1))
$this->logger->expects($this->exactly(2))
->method('info')
->with($this->equalTo('Preview cleanup done for myuid'));
->withConsecutive(
[$this->equalTo('Started preview cleanup for myuid')],
[$this->equalTo('Preview cleanup done for myuid')],
);

$thumbnailFolder->expects($this->once())
->method('delete');
@@ -165,12 +165,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
->with($this->equalTo('myuid'))
->willThrowException(new NotFoundException());

$this->logger->expects($this->at(0))
->method('info')
->with($this->equalTo('Started preview cleanup for myuid'));
$this->logger->expects($this->at(1))
$this->logger->expects($this->exactly(2))
->method('info')
->with($this->equalTo('Preview cleanup done for myuid'));
->withConsecutive(
[$this->equalTo('Started preview cleanup for myuid')],
[$this->equalTo('Preview cleanup done for myuid')],
);

$this->job->run(['uid' => 'myuid']);
}
@@ -189,12 +189,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
->with($this->equalTo('thumbnails'))
->willThrowException(new NotFoundException());

$this->logger->expects($this->at(0))
->method('info')
->with($this->equalTo('Started preview cleanup for myuid'));
$this->logger->expects($this->at(1))
$this->logger->expects($this->exactly(2))
->method('info')
->with($this->equalTo('Preview cleanup done for myuid'));
->withConsecutive(
[$this->equalTo('Started preview cleanup for myuid')],
[$this->equalTo('Preview cleanup done for myuid')],
);

$this->job->run(['uid' => 'myuid']);
}
@@ -229,12 +229,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$this->jobList->expects($this->never())
->method('add');

$this->logger->expects($this->at(0))
$this->logger->expects($this->exactly(2))
->method('info')
->with($this->equalTo('Started preview cleanup for myuid'));
$this->logger->expects($this->at(1))
->method('info')
->with($this->equalTo('Preview cleanup done for myuid'));
->withConsecutive(
[$this->equalTo('Started preview cleanup for myuid')],
[$this->equalTo('Preview cleanup done for myuid')],
);

$thumbnailFolder->expects($this->once())
->method('delete')

+ 10
- 11
tests/Test/Repair/Owncloud/CleanPreviewsTest.php View File

@@ -79,18 +79,17 @@ class CleanPreviewsTest extends TestCase {
$function($user2);
}));

$this->jobList->expects($this->at(0))
$this->jobList->expects($this->exactly(2))
->method('add')
->with(
$this->equalTo(CleanPreviewsBackgroundJob::class),
$this->equalTo(['uid' => 'user1'])
);

$this->jobList->expects($this->at(1))
->method('add')
->with(
$this->equalTo(CleanPreviewsBackgroundJob::class),
$this->equalTo(['uid' => 'user2'])
->withConsecutive(
[
$this->equalTo(CleanPreviewsBackgroundJob::class),
$this->equalTo(['uid' => 'user1'])
],
[
$this->equalTo(CleanPreviewsBackgroundJob::class),
$this->equalTo(['uid' => 'user2'])
],
);

$this->config->expects($this->once())

+ 10
- 20
tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php View File

@@ -96,27 +96,17 @@ class UpdateLanguageCodesTest extends TestCase {

/** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $outputMock */
$outputMock = $this->createMock(IOutput::class);
$outputMock->expects($this->at(0))
$outputMock->expects($this->exactly(7))
->method('info')
->with('Changed 1 setting(s) from "bg_BG" to "bg" in preferences table.');
$outputMock->expects($this->at(1))
->method('info')
->with('Changed 0 setting(s) from "cs_CZ" to "cs" in preferences table.');
$outputMock->expects($this->at(2))
->method('info')
->with('Changed 1 setting(s) from "fi_FI" to "fi" in preferences table.');
$outputMock->expects($this->at(3))
->method('info')
->with('Changed 0 setting(s) from "hu_HU" to "hu" in preferences table.');
$outputMock->expects($this->at(4))
->method('info')
->with('Changed 0 setting(s) from "nb_NO" to "nb" in preferences table.');
$outputMock->expects($this->at(5))
->method('info')
->with('Changed 0 setting(s) from "sk_SK" to "sk" in preferences table.');
$outputMock->expects($this->at(6))
->method('info')
->with('Changed 2 setting(s) from "th_TH" to "th" in preferences table.');
->withConsecutive(
['Changed 1 setting(s) from "bg_BG" to "bg" in preferences table.'],
['Changed 0 setting(s) from "cs_CZ" to "cs" in preferences table.'],
['Changed 1 setting(s) from "fi_FI" to "fi" in preferences table.'],
['Changed 0 setting(s) from "hu_HU" to "hu" in preferences table.'],
['Changed 0 setting(s) from "nb_NO" to "nb" in preferences table.'],
['Changed 0 setting(s) from "sk_SK" to "sk" in preferences table.'],
['Changed 2 setting(s) from "th_TH" to "th" in preferences table.'],
);

$this->config->expects($this->once())
->method('getSystemValue')

Loading…
Cancel
Save