Remove at matchers from tests in:

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

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2022-08-02 15:27:52 +02:00
parent e750137a9a
commit 539162ba8b
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
4 changed files with 49 additions and 63 deletions

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

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))
$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');
@ -165,12 +165,12 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
->with($this->equalTo('myuid'))
->willThrowException(new NotFoundException());
$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')],
);
$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))
$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')],
);
$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')

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

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