Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove at matchers from tests in oauth2 and tests/Test #33435

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions apps/oauth2/tests/Controller/SettingsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,12 @@ protected function setUp(): void {

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');
Expand Down
50 changes: 25 additions & 25 deletions tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ public function testCleanupPreviewsUnfinished() {
$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']);
}
Expand Down Expand Up @@ -146,12 +146,12 @@ public function testCleanupPreviewsFinished() {
$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');
Expand All @@ -165,12 +165,12 @@ public function testNoUserFolder() {
->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']);
}
Expand All @@ -189,12 +189,12 @@ public function testNoThumbnailFolder() {
->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']);
}
Expand Down Expand Up @@ -229,12 +229,12 @@ public function testNotPermittedToDelete() {
$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')
Expand Down
21 changes: 10 additions & 11 deletions tests/Test/Repair/Owncloud/CleanPreviewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,17 @@ public function testRun() {
$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())
Expand Down
30 changes: 10 additions & 20 deletions tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,17 @@ public function testRun() {

/** @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')
Expand Down