]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove at() matcher for tests for files app 32571/head
authorCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 24 May 2022 11:02:07 +0000 (13:02 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 24 May 2022 11:02:07 +0000 (13:02 +0200)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/files/tests/Command/DeleteOrphanedFilesTest.php
apps/files/tests/Controller/ApiControllerTest.php
apps/files/tests/Controller/ViewControllerTest.php

index bf266bc82295277454491ce15f6b75886dcede6a..520d3278e64350f22622c3260ce38ab08f5cfcda 100644 (file)
@@ -132,14 +132,12 @@ class DeleteOrphanedFilesTest extends TestCase {
 
                // parent folder, `files`, ´test` and `welcome.txt` => 4 elements
                $output
-                       ->expects($this->at(0))
+                       ->expects($this->exactly(2))
                        ->method('writeln')
-                       ->with('3 orphaned file cache entries deleted');
-
-               $output
-                       ->expects($this->at(1))
-                       ->method('writeln')
-                       ->with('1 orphaned mount entries deleted');
+                       ->withConsecutive(
+                               ['3 orphaned file cache entries deleted'],
+                               ['1 orphaned mount entries deleted'],
+                       );
 
                $this->command->execute($input, $output);
 
index 73728bd6a4aaf4b51650056a60880377b719e61c..64c70fb2de6c9597c1ba0eef0441fbe88b89be33 100644 (file)
@@ -201,12 +201,12 @@ class ApiControllerTest extends TestCase {
                $mode = 'mtime';
                $direction = 'desc';
 
-               $this->config->expects($this->at(0))
+               $this->config->expects($this->exactly(2))
                        ->method('setUserValue')
-                       ->with($this->user->getUID(), 'files', 'file_sorting', $mode);
-               $this->config->expects($this->at(1))
-                       ->method('setUserValue')
-                       ->with($this->user->getUID(), 'files', 'file_sorting_direction', $direction);
+                       ->withConsecutive(
+                               [$this->user->getUID(), 'files', 'file_sorting', $mode],
+                               [$this->user->getUID(), 'files', 'file_sorting_direction', $direction],
+                       );
 
                $expected = new HTTP\Response();
                $actual = $this->apiController->updateFileSorting($mode, $direction);
index cebb50860d3e41f351f5b68336a29e8351cfb7d1..38f3670d4caea382fd474d26c18d3c4d620f5d41 100644 (file)
@@ -442,11 +442,11 @@ class ViewControllerTest extends TestCase {
                        ->with('testuser1')
                        ->willReturn($baseFolder);
 
-               $baseFolder->expects($this->at(0))
+               $baseFolder->expects($this->once())
                        ->method('getById')
                        ->with(123)
                        ->willReturn([$node]);
-               $baseFolder->expects($this->at(1))
+               $baseFolder->expects($this->once())
                        ->method('getRelativePath')
                        ->with('/testuser1/files/test/sub')
                        ->willReturn('/test/sub');
@@ -482,11 +482,11 @@ class ViewControllerTest extends TestCase {
                        ->method('getName')
                        ->willReturn('somefile.txt');
 
-               $baseFolder->expects($this->at(0))
+               $baseFolder->expects($this->once())
                        ->method('getById')
                        ->with(123)
                        ->willReturn([$node]);
-               $baseFolder->expects($this->at(1))
+               $baseFolder->expects($this->once())
                        ->method('getRelativePath')
                        ->with('testuser1/files/test')
                        ->willReturn('/test');
@@ -508,7 +508,7 @@ class ViewControllerTest extends TestCase {
                        ->with('testuser1')
                        ->willReturn($baseFolder);
 
-               $baseFolder->expects($this->at(0))
+               $baseFolder->expects($this->once())
                        ->method('getById')
                        ->with(123)
                        ->willReturn([]);
@@ -537,11 +537,11 @@ class ViewControllerTest extends TestCase {
                $baseFolderFiles = $this->getMockBuilder(Folder::class)->getMock();
                $baseFolderTrash = $this->getMockBuilder(Folder::class)->getMock();
 
-               $this->rootFolder->expects($this->at(0))
+               $this->rootFolder->expects($this->once())
                        ->method('getUserFolder')
                        ->with('testuser1')
                        ->willReturn($baseFolderFiles);
-               $this->rootFolder->expects($this->at(1))
+               $this->rootFolder->expects($this->once())
                        ->method('get')
                        ->with('testuser1/files_trashbin/files/')
                        ->willReturn($baseFolderTrash);
@@ -559,11 +559,11 @@ class ViewControllerTest extends TestCase {
                        ->method('getName')
                        ->willReturn('somefile.txt');
 
-               $baseFolderTrash->expects($this->at(0))
+               $baseFolderTrash->expects($this->once())
                        ->method('getById')
                        ->with(123)
                        ->willReturn([$node]);
-               $baseFolderTrash->expects($this->at(1))
+               $baseFolderTrash->expects($this->once())
                        ->method('getRelativePath')
                        ->with('testuser1/files_trashbin/files/test.d1462861890/sub')
                        ->willReturn('/test.d1462861890/sub');