Completed
Push — master ( 3911d6...b5b320 )
by
unknown
31:08
created
tests/lib/Contacts/ContactsMenu/EntryTest.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -12,93 +12,93 @@
 block discarded – undo
12 12
 use Test\TestCase;
13 13
 
14 14
 class EntryTest extends TestCase {
15
-	private Entry $entry;
16
-
17
-	protected function setUp(): void {
18
-		parent::setUp();
19
-
20
-		$this->entry = new Entry();
21
-	}
22
-
23
-	public function testSetId(): void {
24
-		$this->entry->setId(123);
25
-		$this->addToAssertionCount(1);
26
-	}
27
-
28
-	public function testSetGetFullName(): void {
29
-		$fn = 'Danette Chaille';
30
-		$this->assertEquals('', $this->entry->getFullName());
31
-		$this->entry->setFullName($fn);
32
-		$this->assertEquals($fn, $this->entry->getFullName());
33
-	}
34
-
35
-	public function testAddGetEMailAddresses(): void {
36
-		$this->assertEmpty($this->entry->getEMailAddresses());
37
-		$this->entry->addEMailAddress('[email protected]');
38
-		$this->assertEquals(['[email protected]'], $this->entry->getEMailAddresses());
39
-	}
40
-
41
-	public function testAddAndSortAction(): void {
42
-		// Three actions, two with equal priority
43
-		$action1 = new LinkAction();
44
-		$action2 = new LinkAction();
45
-		$action3 = new LinkAction();
46
-		$action1->setPriority(10);
47
-		$action1->setName('Bravo');
48
-
49
-		$action2->setPriority(0);
50
-		$action2->setName('Batman');
51
-
52
-		$action3->setPriority(10);
53
-		$action3->setName('Alfa');
54
-
55
-		$this->entry->addAction($action1);
56
-		$this->entry->addAction($action2);
57
-		$this->entry->addAction($action3);
58
-		$sorted = $this->entry->getActions();
59
-
60
-		$this->assertSame($action3, $sorted[0]);
61
-		$this->assertSame($action1, $sorted[1]);
62
-		$this->assertSame($action2, $sorted[2]);
63
-	}
64
-
65
-	public function testSetGetProperties(): void {
66
-		$props = [
67
-			'prop1' => 123,
68
-			'prop2' => 'string',
69
-		];
70
-
71
-		$this->entry->setProperties($props);
72
-
73
-		$this->assertNull($this->entry->getProperty('doesntexist'));
74
-		$this->assertEquals(123, $this->entry->getProperty('prop1'));
75
-		$this->assertEquals('string', $this->entry->getProperty('prop2'));
76
-	}
77
-
78
-	public function testJsonSerialize(): void {
79
-		$expectedJson = [
80
-			'id' => '123',
81
-			'fullName' => 'Guadalupe Frisbey',
82
-			'topAction' => null,
83
-			'actions' => [],
84
-			'lastMessage' => '',
85
-			'avatar' => null,
86
-			'emailAddresses' => ['[email protected]'],
87
-			'profileTitle' => null,
88
-			'profileUrl' => null,
89
-			'status' => null,
90
-			'statusMessage' => null,
91
-			'statusMessageTimestamp' => null,
92
-			'statusIcon' => null,
93
-			'isUser' => false,
94
-			'uid' => null,
95
-		];
96
-
97
-		$this->entry->setId(123);
98
-		$this->entry->setFullName('Guadalupe Frisbey');
99
-		$this->entry->addEMailAddress('[email protected]');
100
-		$json = $this->entry->jsonSerialize();
101
-
102
-		$this->assertEquals($expectedJson, $json);
103
-	}
15
+    private Entry $entry;
16
+
17
+    protected function setUp(): void {
18
+        parent::setUp();
19
+
20
+        $this->entry = new Entry();
21
+    }
22
+
23
+    public function testSetId(): void {
24
+        $this->entry->setId(123);
25
+        $this->addToAssertionCount(1);
26
+    }
27
+
28
+    public function testSetGetFullName(): void {
29
+        $fn = 'Danette Chaille';
30
+        $this->assertEquals('', $this->entry->getFullName());
31
+        $this->entry->setFullName($fn);
32
+        $this->assertEquals($fn, $this->entry->getFullName());
33
+    }
34
+
35
+    public function testAddGetEMailAddresses(): void {
36
+        $this->assertEmpty($this->entry->getEMailAddresses());
37
+        $this->entry->addEMailAddress('[email protected]');
38
+        $this->assertEquals(['[email protected]'], $this->entry->getEMailAddresses());
39
+    }
40
+
41
+    public function testAddAndSortAction(): void {
42
+        // Three actions, two with equal priority
43
+        $action1 = new LinkAction();
44
+        $action2 = new LinkAction();
45
+        $action3 = new LinkAction();
46
+        $action1->setPriority(10);
47
+        $action1->setName('Bravo');
48
+
49
+        $action2->setPriority(0);
50
+        $action2->setName('Batman');
51
+
52
+        $action3->setPriority(10);
53
+        $action3->setName('Alfa');
54
+
55
+        $this->entry->addAction($action1);
56
+        $this->entry->addAction($action2);
57
+        $this->entry->addAction($action3);
58
+        $sorted = $this->entry->getActions();
59
+
60
+        $this->assertSame($action3, $sorted[0]);
61
+        $this->assertSame($action1, $sorted[1]);
62
+        $this->assertSame($action2, $sorted[2]);
63
+    }
64
+
65
+    public function testSetGetProperties(): void {
66
+        $props = [
67
+            'prop1' => 123,
68
+            'prop2' => 'string',
69
+        ];
70
+
71
+        $this->entry->setProperties($props);
72
+
73
+        $this->assertNull($this->entry->getProperty('doesntexist'));
74
+        $this->assertEquals(123, $this->entry->getProperty('prop1'));
75
+        $this->assertEquals('string', $this->entry->getProperty('prop2'));
76
+    }
77
+
78
+    public function testJsonSerialize(): void {
79
+        $expectedJson = [
80
+            'id' => '123',
81
+            'fullName' => 'Guadalupe Frisbey',
82
+            'topAction' => null,
83
+            'actions' => [],
84
+            'lastMessage' => '',
85
+            'avatar' => null,
86
+            'emailAddresses' => ['[email protected]'],
87
+            'profileTitle' => null,
88
+            'profileUrl' => null,
89
+            'status' => null,
90
+            'statusMessage' => null,
91
+            'statusMessageTimestamp' => null,
92
+            'statusIcon' => null,
93
+            'isUser' => false,
94
+            'uid' => null,
95
+        ];
96
+
97
+        $this->entry->setId(123);
98
+        $this->entry->setFullName('Guadalupe Frisbey');
99
+        $this->entry->addEMailAddress('[email protected]');
100
+        $json = $this->entry->jsonSerialize();
101
+
102
+        $this->assertEquals($expectedJson, $json);
103
+    }
104 104
 }
Please login to merge, or discard this patch.
tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -12,36 +12,36 @@
 block discarded – undo
12 12
 use Test\TestCase;
13 13
 
14 14
 class ActionFactoryTest extends TestCase {
15
-	private ActionFactory $actionFactory;
15
+    private ActionFactory $actionFactory;
16 16
 
17
-	protected function setUp(): void {
18
-		parent::setUp();
17
+    protected function setUp(): void {
18
+        parent::setUp();
19 19
 
20
-		$this->actionFactory = new ActionFactory();
21
-	}
20
+        $this->actionFactory = new ActionFactory();
21
+    }
22 22
 
23
-	public function testNewLinkAction(): void {
24
-		$icon = 'icon-test';
25
-		$name = 'Test';
26
-		$href = 'some/url';
23
+    public function testNewLinkAction(): void {
24
+        $icon = 'icon-test';
25
+        $name = 'Test';
26
+        $href = 'some/url';
27 27
 
28
-		$action = $this->actionFactory->newLinkAction($icon, $name, $href);
28
+        $action = $this->actionFactory->newLinkAction($icon, $name, $href);
29 29
 
30
-		$this->assertInstanceOf(IAction::class, $action);
31
-		$this->assertEquals($name, $action->getName());
32
-		$this->assertEquals(10, $action->getPriority());
33
-	}
30
+        $this->assertInstanceOf(IAction::class, $action);
31
+        $this->assertEquals($name, $action->getName());
32
+        $this->assertEquals(10, $action->getPriority());
33
+    }
34 34
 
35
-	public function testNewEMailAction(): void {
36
-		$icon = 'icon-test';
37
-		$name = 'Test';
38
-		$href = '[email protected]';
35
+    public function testNewEMailAction(): void {
36
+        $icon = 'icon-test';
37
+        $name = 'Test';
38
+        $href = '[email protected]';
39 39
 
40
-		$action = $this->actionFactory->newEMailAction($icon, $name, $href);
40
+        $action = $this->actionFactory->newEMailAction($icon, $name, $href);
41 41
 
42
-		$this->assertInstanceOf(IAction::class, $action);
43
-		$this->assertEquals($name, $action->getName());
44
-		$this->assertEquals(10, $action->getPriority());
45
-		$this->assertEquals('mailto:[email protected]', $action->getHref());
46
-	}
42
+        $this->assertInstanceOf(IAction::class, $action);
43
+        $this->assertEquals($name, $action->getName());
44
+        $this->assertEquals(10, $action->getPriority());
45
+        $this->assertEquals('mailto:[email protected]', $action->getHref());
46
+    }
47 47
 }
Please login to merge, or discard this patch.
tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php 1 patch
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -21,202 +21,202 @@
 block discarded – undo
21 21
  * @group DB
22 22
  */
23 23
 class PartitionedQueryBuilderTest extends TestCase {
24
-	private IDBConnection $connection;
25
-	private ShardConnectionManager $shardConnectionManager;
26
-	private AutoIncrementHandler $autoIncrementHandler;
27
-
28
-	protected function setUp(): void {
29
-		if (PHP_INT_SIZE < 8) {
30
-			$this->markTestSkipped('Test requires 64bit');
31
-		}
32
-		$this->connection = Server::get(IDBConnection::class);
33
-		$this->shardConnectionManager = Server::get(ShardConnectionManager::class);
34
-		$this->autoIncrementHandler = Server::get(AutoIncrementHandler::class);
35
-
36
-		$this->setupFileCache();
37
-	}
38
-
39
-	protected function tearDown(): void {
40
-		$this->cleanupDb();
41
-		parent::tearDown();
42
-	}
43
-
44
-
45
-	private function getQueryBuilder(): PartitionedQueryBuilder {
46
-		$builder = $this->connection->getQueryBuilder();
47
-		if ($builder instanceof PartitionedQueryBuilder) {
48
-			return $builder;
49
-		} else {
50
-			return new PartitionedQueryBuilder($builder, [], $this->shardConnectionManager, $this->autoIncrementHandler);
51
-		}
52
-	}
53
-
54
-	private function setupFileCache(): void {
55
-		$this->cleanupDb();
56
-		$query = $this->getQueryBuilder();
57
-		$query->insert('storages')
58
-			->values([
59
-				'numeric_id' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
60
-				'id' => $query->createNamedParameter('test1'),
61
-			]);
62
-		$query->executeStatement();
63
-
64
-		$query = $this->getQueryBuilder();
65
-		$query->insert('filecache')
66
-			->values([
67
-				'storage' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
68
-				'path' => $query->createNamedParameter('file1'),
69
-				'path_hash' => $query->createNamedParameter(md5('file1')),
70
-			]);
71
-		$query->executeStatement();
72
-		$fileId = $query->getLastInsertId();
73
-
74
-		$query = $this->getQueryBuilder();
75
-		$query->insert('filecache_extended')
76
-			->hintShardKey('storage', 1001001)
77
-			->values([
78
-				'fileid' => $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT),
79
-				'upload_time' => $query->createNamedParameter(1234, IQueryBuilder::PARAM_INT),
80
-			]);
81
-		$query->executeStatement();
82
-
83
-		$query = $this->getQueryBuilder();
84
-		$query->insert('mounts')
85
-			->values([
86
-				'storage_id' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
87
-				'user_id' => $query->createNamedParameter('partitioned_test'),
88
-				'mount_point' => $query->createNamedParameter('/mount/point'),
89
-				'mount_provider_class' => $query->createNamedParameter('test'),
90
-				'root_id' => $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT),
91
-			]);
92
-		$query->executeStatement();
93
-	}
94
-
95
-	private function cleanupDb(): void {
96
-		$query = $this->getQueryBuilder();
97
-		$query->delete('storages')
98
-			->where($query->expr()->gt('numeric_id', $query->createNamedParameter(1000000, IQueryBuilder::PARAM_INT)));
99
-		$query->executeStatement();
100
-
101
-		$query = $this->getQueryBuilder();
102
-		$query->delete('filecache')
103
-			->where($query->expr()->gt('storage', $query->createNamedParameter(1000000, IQueryBuilder::PARAM_INT)))
104
-			->runAcrossAllShards();
105
-		$query->executeStatement();
106
-
107
-		$query = $this->getQueryBuilder();
108
-		$query->delete('filecache_extended')
109
-			->runAcrossAllShards();
110
-		$query->executeStatement();
111
-
112
-		$query = $this->getQueryBuilder();
113
-		$query->delete('mounts')
114
-			->where($query->expr()->like('user_id', $query->createNamedParameter('partitioned_%')));
115
-		$query->executeStatement();
116
-	}
117
-
118
-	public function testSimpleOnlyPartitionQuery(): void {
119
-		$builder = $this->getQueryBuilder();
120
-		$builder->addPartition(new PartitionSplit('filecache', ['filecache']));
121
-
122
-		// query borrowed from UserMountCache
123
-		$query = $builder->select('path')
124
-			->from('filecache')
125
-			->where($builder->expr()->eq('storage', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
126
-
127
-		$results = $query->executeQuery()->fetchAll();
128
-		$this->assertCount(1, $results);
129
-		$this->assertEquals($results[0]['path'], 'file1');
130
-	}
131
-
132
-	public function testSimplePartitionedQuery(): void {
133
-		$builder = $this->getQueryBuilder();
134
-		$builder->addPartition(new PartitionSplit('filecache', ['filecache']));
135
-
136
-		// query borrowed from UserMountCache
137
-		$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
138
-			->from('mounts', 'm')
139
-			->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
140
-			->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
141
-
142
-		$query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
143
-
144
-		$this->assertEquals(2, $query->getPartitionCount());
145
-
146
-		$results = $query->executeQuery()->fetchAll();
147
-		$this->assertCount(1, $results);
148
-		$this->assertEquals($results[0]['user_id'], 'partitioned_test');
149
-		$this->assertEquals($results[0]['mount_point'], '/mount/point');
150
-		$this->assertEquals($results[0]['mount_provider_class'], 'test');
151
-		$this->assertEquals($results[0]['path'], 'file1');
152
-	}
153
-
154
-	public function testMultiTablePartitionedQuery(): void {
155
-		$builder = $this->getQueryBuilder();
156
-		$builder->addPartition(new PartitionSplit('filecache', ['filecache', 'filecache_extended']));
157
-
158
-		$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class', 'fe.upload_time')
159
-			->from('mounts', 'm')
160
-			->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
161
-			->innerJoin('f', 'filecache_extended', 'fe', $builder->expr()->eq('f.fileid', 'fe.fileid'))
162
-			->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
163
-
164
-		$query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
165
-
166
-		$this->assertEquals(2, $query->getPartitionCount());
167
-
168
-		$results = $query->executeQuery()->fetchAll();
169
-		$this->assertCount(1, $results);
170
-		$this->assertEquals($results[0]['user_id'], 'partitioned_test');
171
-		$this->assertEquals($results[0]['mount_point'], '/mount/point');
172
-		$this->assertEquals($results[0]['mount_provider_class'], 'test');
173
-		$this->assertEquals($results[0]['path'], 'file1');
174
-		$this->assertEquals($results[0]['upload_time'], 1234);
175
-	}
176
-
177
-	public function testPartitionedQueryFromSplit(): void {
178
-		$builder = $this->getQueryBuilder();
179
-		$builder->addPartition(new PartitionSplit('filecache', ['filecache']));
180
-
181
-		$query = $builder->select('storage', 'm.root_id', 'm.user_id', 'm.mount_point', 'm.mount_id', 'path', 'm.mount_provider_class')
182
-			->from('filecache', 'f')
183
-			->innerJoin('f', 'mounts', 'm', $builder->expr()->eq('m.root_id', 'f.fileid'));
184
-		$query->where($builder->expr()->eq('storage', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
185
-
186
-		$query->andWhere($builder->expr()->eq('m.user_id', $builder->createNamedParameter('partitioned_test')));
187
-
188
-		$this->assertEquals(2, $query->getPartitionCount());
189
-
190
-		$results = $query->executeQuery()->fetchAll();
191
-		$this->assertCount(1, $results);
192
-		$this->assertEquals($results[0]['user_id'], 'partitioned_test');
193
-		$this->assertEquals($results[0]['mount_point'], '/mount/point');
194
-		$this->assertEquals($results[0]['mount_provider_class'], 'test');
195
-		$this->assertEquals($results[0]['path'], 'file1');
196
-	}
197
-
198
-	public function testMultiJoinPartitionedQuery(): void {
199
-		$builder = $this->getQueryBuilder();
200
-		$builder->addPartition(new PartitionSplit('filecache', ['filecache']));
201
-
202
-		// query borrowed from UserMountCache
203
-		$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
204
-			->selectAlias('s.id', 'storage_string_id')
205
-			->from('mounts', 'm')
206
-			->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
207
-			->innerJoin('f', 'storages', 's', $builder->expr()->eq('f.storage', 's.numeric_id'))
208
-			->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
209
-
210
-		$query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
211
-
212
-		$this->assertEquals(3, $query->getPartitionCount());
213
-
214
-		$results = $query->executeQuery()->fetchAll();
215
-		$this->assertCount(1, $results);
216
-		$this->assertEquals($results[0]['user_id'], 'partitioned_test');
217
-		$this->assertEquals($results[0]['mount_point'], '/mount/point');
218
-		$this->assertEquals($results[0]['mount_provider_class'], 'test');
219
-		$this->assertEquals($results[0]['path'], 'file1');
220
-		$this->assertEquals($results[0]['storage_string_id'], 'test1');
221
-	}
24
+    private IDBConnection $connection;
25
+    private ShardConnectionManager $shardConnectionManager;
26
+    private AutoIncrementHandler $autoIncrementHandler;
27
+
28
+    protected function setUp(): void {
29
+        if (PHP_INT_SIZE < 8) {
30
+            $this->markTestSkipped('Test requires 64bit');
31
+        }
32
+        $this->connection = Server::get(IDBConnection::class);
33
+        $this->shardConnectionManager = Server::get(ShardConnectionManager::class);
34
+        $this->autoIncrementHandler = Server::get(AutoIncrementHandler::class);
35
+
36
+        $this->setupFileCache();
37
+    }
38
+
39
+    protected function tearDown(): void {
40
+        $this->cleanupDb();
41
+        parent::tearDown();
42
+    }
43
+
44
+
45
+    private function getQueryBuilder(): PartitionedQueryBuilder {
46
+        $builder = $this->connection->getQueryBuilder();
47
+        if ($builder instanceof PartitionedQueryBuilder) {
48
+            return $builder;
49
+        } else {
50
+            return new PartitionedQueryBuilder($builder, [], $this->shardConnectionManager, $this->autoIncrementHandler);
51
+        }
52
+    }
53
+
54
+    private function setupFileCache(): void {
55
+        $this->cleanupDb();
56
+        $query = $this->getQueryBuilder();
57
+        $query->insert('storages')
58
+            ->values([
59
+                'numeric_id' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
60
+                'id' => $query->createNamedParameter('test1'),
61
+            ]);
62
+        $query->executeStatement();
63
+
64
+        $query = $this->getQueryBuilder();
65
+        $query->insert('filecache')
66
+            ->values([
67
+                'storage' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
68
+                'path' => $query->createNamedParameter('file1'),
69
+                'path_hash' => $query->createNamedParameter(md5('file1')),
70
+            ]);
71
+        $query->executeStatement();
72
+        $fileId = $query->getLastInsertId();
73
+
74
+        $query = $this->getQueryBuilder();
75
+        $query->insert('filecache_extended')
76
+            ->hintShardKey('storage', 1001001)
77
+            ->values([
78
+                'fileid' => $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT),
79
+                'upload_time' => $query->createNamedParameter(1234, IQueryBuilder::PARAM_INT),
80
+            ]);
81
+        $query->executeStatement();
82
+
83
+        $query = $this->getQueryBuilder();
84
+        $query->insert('mounts')
85
+            ->values([
86
+                'storage_id' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
87
+                'user_id' => $query->createNamedParameter('partitioned_test'),
88
+                'mount_point' => $query->createNamedParameter('/mount/point'),
89
+                'mount_provider_class' => $query->createNamedParameter('test'),
90
+                'root_id' => $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT),
91
+            ]);
92
+        $query->executeStatement();
93
+    }
94
+
95
+    private function cleanupDb(): void {
96
+        $query = $this->getQueryBuilder();
97
+        $query->delete('storages')
98
+            ->where($query->expr()->gt('numeric_id', $query->createNamedParameter(1000000, IQueryBuilder::PARAM_INT)));
99
+        $query->executeStatement();
100
+
101
+        $query = $this->getQueryBuilder();
102
+        $query->delete('filecache')
103
+            ->where($query->expr()->gt('storage', $query->createNamedParameter(1000000, IQueryBuilder::PARAM_INT)))
104
+            ->runAcrossAllShards();
105
+        $query->executeStatement();
106
+
107
+        $query = $this->getQueryBuilder();
108
+        $query->delete('filecache_extended')
109
+            ->runAcrossAllShards();
110
+        $query->executeStatement();
111
+
112
+        $query = $this->getQueryBuilder();
113
+        $query->delete('mounts')
114
+            ->where($query->expr()->like('user_id', $query->createNamedParameter('partitioned_%')));
115
+        $query->executeStatement();
116
+    }
117
+
118
+    public function testSimpleOnlyPartitionQuery(): void {
119
+        $builder = $this->getQueryBuilder();
120
+        $builder->addPartition(new PartitionSplit('filecache', ['filecache']));
121
+
122
+        // query borrowed from UserMountCache
123
+        $query = $builder->select('path')
124
+            ->from('filecache')
125
+            ->where($builder->expr()->eq('storage', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
126
+
127
+        $results = $query->executeQuery()->fetchAll();
128
+        $this->assertCount(1, $results);
129
+        $this->assertEquals($results[0]['path'], 'file1');
130
+    }
131
+
132
+    public function testSimplePartitionedQuery(): void {
133
+        $builder = $this->getQueryBuilder();
134
+        $builder->addPartition(new PartitionSplit('filecache', ['filecache']));
135
+
136
+        // query borrowed from UserMountCache
137
+        $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
138
+            ->from('mounts', 'm')
139
+            ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
140
+            ->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
141
+
142
+        $query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
143
+
144
+        $this->assertEquals(2, $query->getPartitionCount());
145
+
146
+        $results = $query->executeQuery()->fetchAll();
147
+        $this->assertCount(1, $results);
148
+        $this->assertEquals($results[0]['user_id'], 'partitioned_test');
149
+        $this->assertEquals($results[0]['mount_point'], '/mount/point');
150
+        $this->assertEquals($results[0]['mount_provider_class'], 'test');
151
+        $this->assertEquals($results[0]['path'], 'file1');
152
+    }
153
+
154
+    public function testMultiTablePartitionedQuery(): void {
155
+        $builder = $this->getQueryBuilder();
156
+        $builder->addPartition(new PartitionSplit('filecache', ['filecache', 'filecache_extended']));
157
+
158
+        $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class', 'fe.upload_time')
159
+            ->from('mounts', 'm')
160
+            ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
161
+            ->innerJoin('f', 'filecache_extended', 'fe', $builder->expr()->eq('f.fileid', 'fe.fileid'))
162
+            ->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
163
+
164
+        $query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
165
+
166
+        $this->assertEquals(2, $query->getPartitionCount());
167
+
168
+        $results = $query->executeQuery()->fetchAll();
169
+        $this->assertCount(1, $results);
170
+        $this->assertEquals($results[0]['user_id'], 'partitioned_test');
171
+        $this->assertEquals($results[0]['mount_point'], '/mount/point');
172
+        $this->assertEquals($results[0]['mount_provider_class'], 'test');
173
+        $this->assertEquals($results[0]['path'], 'file1');
174
+        $this->assertEquals($results[0]['upload_time'], 1234);
175
+    }
176
+
177
+    public function testPartitionedQueryFromSplit(): void {
178
+        $builder = $this->getQueryBuilder();
179
+        $builder->addPartition(new PartitionSplit('filecache', ['filecache']));
180
+
181
+        $query = $builder->select('storage', 'm.root_id', 'm.user_id', 'm.mount_point', 'm.mount_id', 'path', 'm.mount_provider_class')
182
+            ->from('filecache', 'f')
183
+            ->innerJoin('f', 'mounts', 'm', $builder->expr()->eq('m.root_id', 'f.fileid'));
184
+        $query->where($builder->expr()->eq('storage', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
185
+
186
+        $query->andWhere($builder->expr()->eq('m.user_id', $builder->createNamedParameter('partitioned_test')));
187
+
188
+        $this->assertEquals(2, $query->getPartitionCount());
189
+
190
+        $results = $query->executeQuery()->fetchAll();
191
+        $this->assertCount(1, $results);
192
+        $this->assertEquals($results[0]['user_id'], 'partitioned_test');
193
+        $this->assertEquals($results[0]['mount_point'], '/mount/point');
194
+        $this->assertEquals($results[0]['mount_provider_class'], 'test');
195
+        $this->assertEquals($results[0]['path'], 'file1');
196
+    }
197
+
198
+    public function testMultiJoinPartitionedQuery(): void {
199
+        $builder = $this->getQueryBuilder();
200
+        $builder->addPartition(new PartitionSplit('filecache', ['filecache']));
201
+
202
+        // query borrowed from UserMountCache
203
+        $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
204
+            ->selectAlias('s.id', 'storage_string_id')
205
+            ->from('mounts', 'm')
206
+            ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
207
+            ->innerJoin('f', 'storages', 's', $builder->expr()->eq('f.storage', 's.numeric_id'))
208
+            ->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
209
+
210
+        $query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
211
+
212
+        $this->assertEquals(3, $query->getPartitionCount());
213
+
214
+        $results = $query->executeQuery()->fetchAll();
215
+        $this->assertCount(1, $results);
216
+        $this->assertEquals($results[0]['user_id'], 'partitioned_test');
217
+        $this->assertEquals($results[0]['mount_point'], '/mount/point');
218
+        $this->assertEquals($results[0]['mount_provider_class'], 'test');
219
+        $this->assertEquals($results[0]['path'], 'file1');
220
+        $this->assertEquals($results[0]['storage_string_id'], 'test1');
221
+    }
222 222
 }
Please login to merge, or discard this patch.
tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -23,106 +23,106 @@
 block discarded – undo
23 23
  * @group DB
24 24
  */
25 25
 class SharedQueryBuilderTest extends TestCase {
26
-	private IDBConnection $connection;
27
-	private AutoIncrementHandler $autoIncrementHandler;
28
-
29
-	protected function setUp(): void {
30
-		if (PHP_INT_SIZE < 8) {
31
-			$this->markTestSkipped('Test requires 64bit');
32
-		}
33
-		$this->connection = Server::get(IDBConnection::class);
34
-		$this->autoIncrementHandler = Server::get(AutoIncrementHandler::class);
35
-	}
36
-
37
-
38
-	private function getQueryBuilder(string $table, string $shardColumn, string $primaryColumn, array $companionTables = []): ShardedQueryBuilder {
39
-		return new ShardedQueryBuilder(
40
-			$this->connection->getQueryBuilder(),
41
-			[
42
-				new ShardDefinition($table, $primaryColumn, [], $shardColumn, new RoundRobinShardMapper(), $companionTables, [], 0, 0),
43
-			],
44
-			$this->createMock(ShardConnectionManager::class),
45
-			$this->autoIncrementHandler,
46
-		);
47
-	}
48
-
49
-	public function testGetShardKeySingleParam(): void {
50
-		$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
51
-		$query->select('fileid', 'path')
52
-			->from('filecache')
53
-			->where($query->expr()->eq('storage', $query->createNamedParameter(10, IQueryBuilder::PARAM_INT)));
54
-
55
-		$this->assertEquals([], $query->getPrimaryKeys());
56
-		$this->assertEquals([10], $query->getShardKeys());
57
-	}
58
-
59
-	public function testGetPrimaryKeyParam(): void {
60
-		$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
61
-		$query->select('fileid', 'path')
62
-			->from('filecache')
63
-			->where($query->expr()->in('fileid', $query->createNamedParameter([10, 11], IQueryBuilder::PARAM_INT)));
64
-
65
-		$this->assertEquals([10, 11], $query->getPrimaryKeys());
66
-		$this->assertEquals([], $query->getShardKeys());
67
-	}
68
-
69
-	public function testValidateWithShardKey(): void {
70
-		$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
71
-		$query->select('fileid', 'path')
72
-			->from('filecache')
73
-			->where($query->expr()->eq('storage', $query->createNamedParameter(10)));
74
-
75
-		$query->validate();
76
-		$this->assertTrue(true);
77
-	}
78
-
79
-	public function testValidateWithPrimaryKey(): void {
80
-		$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
81
-		$query->select('fileid', 'path')
82
-			->from('filecache')
83
-			->where($query->expr()->in('fileid', $query->createNamedParameter([10, 11], IQueryBuilder::PARAM_INT)));
84
-
85
-		$query->validate();
86
-		$this->assertTrue(true);
87
-	}
88
-
89
-	public function testValidateWithNoKey(): void {
90
-		$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
91
-		$query->select('fileid', 'path')
92
-			->from('filecache')
93
-			->where($query->expr()->lt('size', $query->createNamedParameter(0)));
94
-
95
-		$this->expectException(InvalidShardedQueryException::class);
96
-		$query->validate();
97
-		$this->fail('exception expected');
98
-	}
99
-
100
-	public function testValidateNonSharedTable(): void {
101
-		$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
102
-		$query->select('configvalue')
103
-			->from('appconfig')
104
-			->where($query->expr()->eq('configkey', $query->createNamedParameter('test')));
105
-
106
-		$query->validate();
107
-		$this->assertTrue(true);
108
-	}
109
-
110
-	public function testGetShardKeyMultipleSingleParam(): void {
111
-		$query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
112
-		$query->select('fileid', 'path')
113
-			->from('filecache')
114
-			->where($query->expr()->andX(
115
-				$query->expr()->gt('mtime', $query->createNamedParameter(0), IQueryBuilder::PARAM_INT),
116
-				$query->expr()->orX(
117
-					$query->expr()->eq('storage', $query->createNamedParameter(10, IQueryBuilder::PARAM_INT)),
118
-					$query->expr()->andX(
119
-						$query->expr()->eq('storage', $query->createNamedParameter(11, IQueryBuilder::PARAM_INT)),
120
-						$query->expr()->like('path', $query->createNamedParameter('foo/%'))
121
-					)
122
-				)
123
-			));
124
-
125
-		$this->assertEquals([], $query->getPrimaryKeys());
126
-		$this->assertEquals([10, 11], $query->getShardKeys());
127
-	}
26
+    private IDBConnection $connection;
27
+    private AutoIncrementHandler $autoIncrementHandler;
28
+
29
+    protected function setUp(): void {
30
+        if (PHP_INT_SIZE < 8) {
31
+            $this->markTestSkipped('Test requires 64bit');
32
+        }
33
+        $this->connection = Server::get(IDBConnection::class);
34
+        $this->autoIncrementHandler = Server::get(AutoIncrementHandler::class);
35
+    }
36
+
37
+
38
+    private function getQueryBuilder(string $table, string $shardColumn, string $primaryColumn, array $companionTables = []): ShardedQueryBuilder {
39
+        return new ShardedQueryBuilder(
40
+            $this->connection->getQueryBuilder(),
41
+            [
42
+                new ShardDefinition($table, $primaryColumn, [], $shardColumn, new RoundRobinShardMapper(), $companionTables, [], 0, 0),
43
+            ],
44
+            $this->createMock(ShardConnectionManager::class),
45
+            $this->autoIncrementHandler,
46
+        );
47
+    }
48
+
49
+    public function testGetShardKeySingleParam(): void {
50
+        $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
51
+        $query->select('fileid', 'path')
52
+            ->from('filecache')
53
+            ->where($query->expr()->eq('storage', $query->createNamedParameter(10, IQueryBuilder::PARAM_INT)));
54
+
55
+        $this->assertEquals([], $query->getPrimaryKeys());
56
+        $this->assertEquals([10], $query->getShardKeys());
57
+    }
58
+
59
+    public function testGetPrimaryKeyParam(): void {
60
+        $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
61
+        $query->select('fileid', 'path')
62
+            ->from('filecache')
63
+            ->where($query->expr()->in('fileid', $query->createNamedParameter([10, 11], IQueryBuilder::PARAM_INT)));
64
+
65
+        $this->assertEquals([10, 11], $query->getPrimaryKeys());
66
+        $this->assertEquals([], $query->getShardKeys());
67
+    }
68
+
69
+    public function testValidateWithShardKey(): void {
70
+        $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
71
+        $query->select('fileid', 'path')
72
+            ->from('filecache')
73
+            ->where($query->expr()->eq('storage', $query->createNamedParameter(10)));
74
+
75
+        $query->validate();
76
+        $this->assertTrue(true);
77
+    }
78
+
79
+    public function testValidateWithPrimaryKey(): void {
80
+        $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
81
+        $query->select('fileid', 'path')
82
+            ->from('filecache')
83
+            ->where($query->expr()->in('fileid', $query->createNamedParameter([10, 11], IQueryBuilder::PARAM_INT)));
84
+
85
+        $query->validate();
86
+        $this->assertTrue(true);
87
+    }
88
+
89
+    public function testValidateWithNoKey(): void {
90
+        $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
91
+        $query->select('fileid', 'path')
92
+            ->from('filecache')
93
+            ->where($query->expr()->lt('size', $query->createNamedParameter(0)));
94
+
95
+        $this->expectException(InvalidShardedQueryException::class);
96
+        $query->validate();
97
+        $this->fail('exception expected');
98
+    }
99
+
100
+    public function testValidateNonSharedTable(): void {
101
+        $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
102
+        $query->select('configvalue')
103
+            ->from('appconfig')
104
+            ->where($query->expr()->eq('configkey', $query->createNamedParameter('test')));
105
+
106
+        $query->validate();
107
+        $this->assertTrue(true);
108
+    }
109
+
110
+    public function testGetShardKeyMultipleSingleParam(): void {
111
+        $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
112
+        $query->select('fileid', 'path')
113
+            ->from('filecache')
114
+            ->where($query->expr()->andX(
115
+                $query->expr()->gt('mtime', $query->createNamedParameter(0), IQueryBuilder::PARAM_INT),
116
+                $query->expr()->orX(
117
+                    $query->expr()->eq('storage', $query->createNamedParameter(10, IQueryBuilder::PARAM_INT)),
118
+                    $query->expr()->andX(
119
+                        $query->expr()->eq('storage', $query->createNamedParameter(11, IQueryBuilder::PARAM_INT)),
120
+                        $query->expr()->like('path', $query->createNamedParameter('foo/%'))
121
+                    )
122
+                )
123
+            ));
124
+
125
+        $this->assertEquals([], $query->getPrimaryKeys());
126
+        $this->assertEquals([10, 11], $query->getShardKeys());
127
+    }
128 128
 }
Please login to merge, or discard this patch.
tests/lib/DB/ConnectionTest.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -22,80 +22,80 @@
 block discarded – undo
22 22
  */
23 23
 class ConnectionTest extends TestCase {
24 24
 
25
-	public function testSingleNodeConnectsToPrimaryOnly(): void {
26
-		$connectionParams = [
27
-			'user' => 'test',
28
-			'password' => 'topsecret',
29
-			'host' => 'test',
30
-		];
31
-		$adapter = $this->createMock(Adapter::class);
32
-		$driver = $this->createMock(Driver::class);
33
-		$configuration = $this->createMock(Configuration::class);
34
-		$connection = $this->getMockBuilder(Connection::class)
35
-			->onlyMethods(['connectTo'])
36
-			->setConstructorArgs([
37
-				[
38
-					'adapter' => $adapter,
39
-					'platform' => new MySQLPlatform(),
40
-					'tablePrefix' => 'nctest',
41
-					'primary' => $connectionParams,
42
-					'replica' => [
43
-						$connectionParams,
44
-					],
45
-				],
46
-				$driver,
47
-				$configuration,
48
-			])
49
-			->getMock();
50
-		$driverConnection = $this->createMock(DriverConnection::class);
51
-		$connection->expects(self::once())
52
-			->method('connectTo')
53
-			->with('primary')
54
-			->willReturn($driverConnection);
25
+    public function testSingleNodeConnectsToPrimaryOnly(): void {
26
+        $connectionParams = [
27
+            'user' => 'test',
28
+            'password' => 'topsecret',
29
+            'host' => 'test',
30
+        ];
31
+        $adapter = $this->createMock(Adapter::class);
32
+        $driver = $this->createMock(Driver::class);
33
+        $configuration = $this->createMock(Configuration::class);
34
+        $connection = $this->getMockBuilder(Connection::class)
35
+            ->onlyMethods(['connectTo'])
36
+            ->setConstructorArgs([
37
+                [
38
+                    'adapter' => $adapter,
39
+                    'platform' => new MySQLPlatform(),
40
+                    'tablePrefix' => 'nctest',
41
+                    'primary' => $connectionParams,
42
+                    'replica' => [
43
+                        $connectionParams,
44
+                    ],
45
+                ],
46
+                $driver,
47
+                $configuration,
48
+            ])
49
+            ->getMock();
50
+        $driverConnection = $this->createMock(DriverConnection::class);
51
+        $connection->expects(self::once())
52
+            ->method('connectTo')
53
+            ->with('primary')
54
+            ->willReturn($driverConnection);
55 55
 
56
-		$connection->ensureConnectedToReplica();
57
-		$connection->ensureConnectedToPrimary();
58
-		$connection->ensureConnectedToReplica();
59
-	}
56
+        $connection->ensureConnectedToReplica();
57
+        $connection->ensureConnectedToPrimary();
58
+        $connection->ensureConnectedToReplica();
59
+    }
60 60
 
61
-	public function testClusterConnectsToPrimaryAndReplica(): void {
62
-		$connectionParamsPrimary = [
63
-			'user' => 'test',
64
-			'password' => 'topsecret',
65
-			'host' => 'testprimary',
66
-		];
67
-		$connectionParamsReplica = [
68
-			'user' => 'test',
69
-			'password' => 'topsecret',
70
-			'host' => 'testreplica',
71
-		];
72
-		$adapter = $this->createMock(Adapter::class);
73
-		$driver = $this->createMock(Driver::class);
74
-		$configuration = $this->createMock(Configuration::class);
75
-		$connection = $this->getMockBuilder(Connection::class)
76
-			->onlyMethods(['connectTo'])
77
-			->setConstructorArgs([
78
-				[
79
-					'adapter' => $adapter,
80
-					'platform' => new MySQLPlatform(),
81
-					'tablePrefix' => 'nctest',
82
-					'primary' => $connectionParamsPrimary,
83
-					'replica' => [
84
-						$connectionParamsReplica,
85
-					],
86
-				],
87
-				$driver,
88
-				$configuration,
89
-			])
90
-			->getMock();
91
-		$driverConnection = $this->createMock(DriverConnection::class);
92
-		$connection->expects(self::exactly(2))
93
-			->method('connectTo')
94
-			->willReturn($driverConnection);
61
+    public function testClusterConnectsToPrimaryAndReplica(): void {
62
+        $connectionParamsPrimary = [
63
+            'user' => 'test',
64
+            'password' => 'topsecret',
65
+            'host' => 'testprimary',
66
+        ];
67
+        $connectionParamsReplica = [
68
+            'user' => 'test',
69
+            'password' => 'topsecret',
70
+            'host' => 'testreplica',
71
+        ];
72
+        $adapter = $this->createMock(Adapter::class);
73
+        $driver = $this->createMock(Driver::class);
74
+        $configuration = $this->createMock(Configuration::class);
75
+        $connection = $this->getMockBuilder(Connection::class)
76
+            ->onlyMethods(['connectTo'])
77
+            ->setConstructorArgs([
78
+                [
79
+                    'adapter' => $adapter,
80
+                    'platform' => new MySQLPlatform(),
81
+                    'tablePrefix' => 'nctest',
82
+                    'primary' => $connectionParamsPrimary,
83
+                    'replica' => [
84
+                        $connectionParamsReplica,
85
+                    ],
86
+                ],
87
+                $driver,
88
+                $configuration,
89
+            ])
90
+            ->getMock();
91
+        $driverConnection = $this->createMock(DriverConnection::class);
92
+        $connection->expects(self::exactly(2))
93
+            ->method('connectTo')
94
+            ->willReturn($driverConnection);
95 95
 
96
-		$connection->ensureConnectedToReplica();
97
-		$connection->ensureConnectedToPrimary();
98
-		$connection->ensureConnectedToReplica();
99
-	}
96
+        $connection->ensureConnectedToReplica();
97
+        $connection->ensureConnectedToPrimary();
98
+        $connection->ensureConnectedToReplica();
99
+    }
100 100
 
101 101
 }
Please login to merge, or discard this patch.
tests/lib/Collaboration/Resources/ManagerTest.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -18,29 +18,29 @@
 block discarded – undo
18 18
 
19 19
 class ManagerTest extends TestCase {
20 20
 
21
-	protected LoggerInterface&MockObject $logger;
22
-	protected IProviderManager&MockObject $providerManager;
23
-	protected IManager $manager;
24
-
25
-	protected function setUp(): void {
26
-		parent::setUp();
27
-
28
-		$this->logger = $this->createMock(LoggerInterface::class);
29
-		$this->providerManager = $this->createMock(IProviderManager::class);
30
-
31
-		/** @var IDBConnection $connection */
32
-		$connection = $this->createMock(IDBConnection::class);
33
-		$this->manager = new Manager($connection, $this->providerManager, $this->logger);
34
-	}
35
-
36
-	public function testRegisterResourceProvider(): void {
37
-		$this->logger->expects($this->once())
38
-			->method('debug')
39
-			->with($this->equalTo('\OC\Collaboration\Resources\Manager::registerResourceProvider is deprecated'), $this->equalTo(['provider' => 'AwesomeResourceProvider']));
40
-		$this->providerManager->expects($this->once())
41
-			->method('registerResourceProvider')
42
-			->with($this->equalTo('AwesomeResourceProvider'));
43
-
44
-		$this->manager->registerResourceProvider('AwesomeResourceProvider');
45
-	}
21
+    protected LoggerInterface&MockObject $logger;
22
+    protected IProviderManager&MockObject $providerManager;
23
+    protected IManager $manager;
24
+
25
+    protected function setUp(): void {
26
+        parent::setUp();
27
+
28
+        $this->logger = $this->createMock(LoggerInterface::class);
29
+        $this->providerManager = $this->createMock(IProviderManager::class);
30
+
31
+        /** @var IDBConnection $connection */
32
+        $connection = $this->createMock(IDBConnection::class);
33
+        $this->manager = new Manager($connection, $this->providerManager, $this->logger);
34
+    }
35
+
36
+    public function testRegisterResourceProvider(): void {
37
+        $this->logger->expects($this->once())
38
+            ->method('debug')
39
+            ->with($this->equalTo('\OC\Collaboration\Resources\Manager::registerResourceProvider is deprecated'), $this->equalTo(['provider' => 'AwesomeResourceProvider']));
40
+        $this->providerManager->expects($this->once())
41
+            ->method('registerResourceProvider')
42
+            ->with($this->equalTo('AwesomeResourceProvider'));
43
+
44
+        $this->manager->registerResourceProvider('AwesomeResourceProvider');
45
+    }
46 46
 }
Please login to merge, or discard this patch.
tests/lib/Session/Session.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -9,58 +9,58 @@
 block discarded – undo
9 9
 namespace Test\Session;
10 10
 
11 11
 abstract class Session extends \Test\TestCase {
12
-	/**
13
-	 * @var \OC\Session\Session
14
-	 */
15
-	protected $instance;
12
+    /**
13
+     * @var \OC\Session\Session
14
+     */
15
+    protected $instance;
16 16
 
17
-	protected function tearDown(): void {
18
-		$this->instance->clear();
19
-		parent::tearDown();
20
-	}
17
+    protected function tearDown(): void {
18
+        $this->instance->clear();
19
+        parent::tearDown();
20
+    }
21 21
 
22
-	public function testNotExistsEmpty(): void {
23
-		$this->assertFalse($this->instance->exists('foo'));
24
-	}
22
+    public function testNotExistsEmpty(): void {
23
+        $this->assertFalse($this->instance->exists('foo'));
24
+    }
25 25
 
26
-	public function testExistsAfterSet(): void {
27
-		$this->instance->set('foo', 1);
28
-		$this->assertTrue($this->instance->exists('foo'));
29
-	}
26
+    public function testExistsAfterSet(): void {
27
+        $this->instance->set('foo', 1);
28
+        $this->assertTrue($this->instance->exists('foo'));
29
+    }
30 30
 
31
-	public function testNotExistsAfterRemove(): void {
32
-		$this->instance->set('foo', 1);
33
-		$this->instance->remove('foo');
34
-		$this->assertFalse($this->instance->exists('foo'));
35
-	}
31
+    public function testNotExistsAfterRemove(): void {
32
+        $this->instance->set('foo', 1);
33
+        $this->instance->remove('foo');
34
+        $this->assertFalse($this->instance->exists('foo'));
35
+    }
36 36
 
37
-	public function testGetNonExisting(): void {
38
-		$this->assertNull($this->instance->get('foo'));
39
-	}
37
+    public function testGetNonExisting(): void {
38
+        $this->assertNull($this->instance->get('foo'));
39
+    }
40 40
 
41
-	public function testGetAfterSet(): void {
42
-		$this->instance->set('foo', 'bar');
43
-		$this->assertEquals('bar', $this->instance->get(('foo')));
44
-	}
41
+    public function testGetAfterSet(): void {
42
+        $this->instance->set('foo', 'bar');
43
+        $this->assertEquals('bar', $this->instance->get(('foo')));
44
+    }
45 45
 
46
-	public function testRemoveNonExisting(): void {
47
-		$this->assertFalse($this->instance->exists('foo'));
48
-		$this->instance->remove('foo');
49
-		$this->assertFalse($this->instance->exists('foo'));
50
-	}
46
+    public function testRemoveNonExisting(): void {
47
+        $this->assertFalse($this->instance->exists('foo'));
48
+        $this->instance->remove('foo');
49
+        $this->assertFalse($this->instance->exists('foo'));
50
+    }
51 51
 
52
-	public function testNotExistsAfterClear(): void {
53
-		$this->instance->set('foo', 1);
54
-		$this->instance->clear();
55
-		$this->assertFalse($this->instance->exists('foo'));
56
-	}
52
+    public function testNotExistsAfterClear(): void {
53
+        $this->instance->set('foo', 1);
54
+        $this->instance->clear();
55
+        $this->assertFalse($this->instance->exists('foo'));
56
+    }
57 57
 
58
-	public function testArrayInterface(): void {
59
-		$this->assertFalse(isset($this->instance['foo']));
60
-		$this->instance['foo'] = 'bar';
61
-		$this->assertTrue(isset($this->instance['foo']));
62
-		$this->assertEquals('bar', $this->instance['foo']);
63
-		unset($this->instance['foo']);
64
-		$this->assertFalse(isset($this->instance['foo']));
65
-	}
58
+    public function testArrayInterface(): void {
59
+        $this->assertFalse(isset($this->instance['foo']));
60
+        $this->instance['foo'] = 'bar';
61
+        $this->assertTrue(isset($this->instance['foo']));
62
+        $this->assertEquals('bar', $this->instance['foo']);
63
+        unset($this->instance['foo']);
64
+        $this->assertFalse(isset($this->instance['foo']));
65
+    }
66 66
 }
Please login to merge, or discard this patch.
tests/lib/BackgroundJob/TestTimedJobNew.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
 use OCP\BackgroundJob\TimedJob;
14 14
 
15 15
 class TestTimedJobNew extends TimedJob {
16
-	public bool $ran = false;
16
+    public bool $ran = false;
17 17
 
18
-	public function __construct(ITimeFactory $timeFactory) {
19
-		parent::__construct($timeFactory);
20
-		$this->setInterval(10);
21
-	}
18
+    public function __construct(ITimeFactory $timeFactory) {
19
+        parent::__construct($timeFactory);
20
+        $this->setInterval(10);
21
+    }
22 22
 
23
-	public function run($argument) {
24
-		$this->ran = true;
25
-	}
23
+    public function run($argument) {
24
+        $this->ran = true;
25
+    }
26 26
 }
Please login to merge, or discard this patch.
tests/lib/App/AppStore/Bundles/EducationBundleTest.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,19 +9,19 @@
 block discarded – undo
9 9
 use OC\App\AppStore\Bundles\EducationBundle;
10 10
 
11 11
 class EducationBundleTest extends BundleBase {
12
-	protected function setUp(): void {
13
-		parent::setUp();
14
-		$this->bundle = new EducationBundle($this->l10n);
15
-		$this->bundleIdentifier = 'EducationBundle';
16
-		$this->bundleName = 'Education bundle';
17
-		$this->bundleAppIds = [
18
-			'dashboard',
19
-			'circles',
20
-			'groupfolders',
21
-			'announcementcenter',
22
-			'quota_warning',
23
-			'user_saml',
24
-			'whiteboard',
25
-		];
26
-	}
12
+    protected function setUp(): void {
13
+        parent::setUp();
14
+        $this->bundle = new EducationBundle($this->l10n);
15
+        $this->bundleIdentifier = 'EducationBundle';
16
+        $this->bundleName = 'Education bundle';
17
+        $this->bundleAppIds = [
18
+            'dashboard',
19
+            'circles',
20
+            'groupfolders',
21
+            'announcementcenter',
22
+            'quota_warning',
23
+            'user_saml',
24
+            'whiteboard',
25
+        ];
26
+    }
27 27
 }
Please login to merge, or discard this patch.