summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php')
-rw-r--r--apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php108
1 files changed, 49 insertions, 59 deletions
diff --git a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
index 427bf6da145..073465cd24c 100644
--- a/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
+++ b/apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php
@@ -36,7 +36,6 @@ use OCP\Migration\IOutput;
use Test\TestCase;
class RefreshWebcalJobRegistrarTest extends TestCase {
-
/** @var IDBConnection | \PHPUnit\Framework\MockObject\MockObject */
private $db;
@@ -69,77 +68,68 @@ class RefreshWebcalJobRegistrarTest extends TestCase {
->method('getQueryBuilder')
->willReturn($queryBuilder);
- $queryBuilder->expects($this->at(0))
+ $queryBuilder->expects($this->once())
->method('select')
->with(['principaluri', 'uri'])
->willReturn($queryBuilder);
- $queryBuilder->expects($this->at(1))
+ $queryBuilder->expects($this->once())
->method('from')
->with('calendarsubscriptions')
->willReturn($queryBuilder);
- $queryBuilder->expects($this->at(2))
+ $queryBuilder->expects($this->once())
->method('execute')
->willReturn($statement);
- $statement->expects($this->at(0))
- ->method('fetch')
- ->with(\PDO::FETCH_ASSOC)
- ->willReturn([
- 'principaluri' => 'foo1',
- 'uri' => 'bar1',
- ]);
- $statement->expects($this->at(1))
+ $statement->expects($this->exactly(4))
->method('fetch')
->with(\PDO::FETCH_ASSOC)
- ->willReturn([
- 'principaluri' => 'foo2',
- 'uri' => 'bar2',
- ]);
- $statement->expects($this->at(2))
- ->method('fetch')
- ->with(\PDO::FETCH_ASSOC)
- ->willReturn([
- 'principaluri' => 'foo3',
- 'uri' => 'bar3',
- ]);
- $statement->expects($this->at(0))
- ->method('fetch')
- ->with(\PDO::FETCH_ASSOC)
- ->willReturn(null);
-
- $this->jobList->expects($this->at(0))
- ->method('has')
- ->with(RefreshWebcalJob::class, [
- 'principaluri' => 'foo1',
- 'uri' => 'bar1',
- ])
- ->willReturn(false);
- $this->jobList->expects($this->at(1))
- ->method('add')
- ->with(RefreshWebcalJob::class, [
- 'principaluri' => 'foo1',
- 'uri' => 'bar1',
- ]);
- $this->jobList->expects($this->at(2))
- ->method('has')
- ->with(RefreshWebcalJob::class, [
- 'principaluri' => 'foo2',
- 'uri' => 'bar2',
- ])
- ->willReturn(true);
- $this->jobList->expects($this->at(3))
+ ->willReturnOnConsecutiveCalls(
+ [
+ 'principaluri' => 'foo1',
+ 'uri' => 'bar1',
+ ],
+ [
+ 'principaluri' => 'foo2',
+ 'uri' => 'bar2',
+ ],
+ [
+ 'principaluri' => 'foo3',
+ 'uri' => 'bar3',
+ ],
+ null
+ );
+
+ $this->jobList->expects($this->exactly(3))
->method('has')
- ->with(RefreshWebcalJob::class, [
- 'principaluri' => 'foo3',
- 'uri' => 'bar3',
- ])
- ->willReturn(false);
- $this->jobList->expects($this->at(4))
+ ->withConsecutive(
+ [RefreshWebcalJob::class, [
+ 'principaluri' => 'foo1',
+ 'uri' => 'bar1',
+ ]],
+ [RefreshWebcalJob::class, [
+ 'principaluri' => 'foo2',
+ 'uri' => 'bar2',
+ ]],
+ [RefreshWebcalJob::class, [
+ 'principaluri' => 'foo3',
+ 'uri' => 'bar3',
+ ]])
+ ->willReturnOnConsecutiveCalls(
+ false,
+ true,
+ false,
+ );
+ $this->jobList->expects($this->exactly(2))
->method('add')
- ->with(RefreshWebcalJob::class, [
- 'principaluri' => 'foo3',
- 'uri' => 'bar3',
- ]);
+ ->withConsecutive(
+ [RefreshWebcalJob::class, [
+ 'principaluri' => 'foo1',
+ 'uri' => 'bar1',
+ ]],
+ [RefreshWebcalJob::class, [
+ 'principaluri' => 'foo3',
+ 'uri' => 'bar3',
+ ]]);
$output->expects($this->once())
->method('info')