Skip to content
Open
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
15 changes: 11 additions & 4 deletions tests/lib/Comments/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ protected function setUp(): void {
$this->connection->prepare($sql)->execute();
}

protected function addDatabaseEntry(?string $parentId, ?string $topmostParentId, ?\DateTimeInterface $creationDT = null, ?\DateTimeInterface $latestChildDT = null, $objectId = null, ?\DateTimeInterface $expireDate = null): string {
protected function addDatabaseEntry(
?string $parentId,
?string $topmostParentId,
?\DateTimeInterface $creationDT = null,
?\DateTimeInterface $latestChildDT = null,
?string $objectId = null,
?\DateTimeInterface $expireDate = null
): string {
$creationDT ??= new \DateTime();
$latestChildDT ??= new \DateTime('yesterday');
$objectId ??= 'file64';
Expand Down Expand Up @@ -353,11 +360,11 @@ public function testGetNumberOfUnreadCommentsForFolder(): void {
// 2 comments for 1112 with no read marker
// 1 comment for 1113 before read marker
// 1 comment for 1114 with no read marker
$this->addDatabaseEntry('0', '0', null, null, $fileIds[1]);
$this->addDatabaseEntry('0', '0', null, null, (string)$fileIds[1]);
for ($i = 0; $i < 4; $i++) {
$this->addDatabaseEntry('0', '0', null, null, $fileIds[$i]);
$this->addDatabaseEntry('0', '0', null, null, (string)$fileIds[$i]);
}
$this->addDatabaseEntry('0', '0', (new \DateTime())->modify('-2 days'), null, $fileIds[0]);
$this->addDatabaseEntry('0', '0', (new \DateTime())->modify('-2 days'), null, (string)$fileIds[0]);
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/User/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public function testLogin(): void {
}

public function testSearch(): void {
$name1 = 'foobarbaz';
$name2 = 'bazbarfoo';
$name3 = 'notme';
$name4 = 'under_score';
$name1 = $this->getUser() . 'foobarbaz';
$name2 = $this->getUser() . 'bazbarfoo';
$name3 = $this->getUser() . 'notme';
$name4 = $this->getUser() . 'under_score';

$this->backend->createUser($name1, 'pass1');
$this->backend->createUser($name2, 'pass2');
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/User/DatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ function (Event $event): void {
}

public function testCreateUserInvalidatesCache(): void {
$user1 = $this->getUniqueID('test_');
$user1 = $this->getUser();
$this->assertFalse($this->backend->userExists($user1));
$this->backend->createUser($user1, 'pw');
$this->assertTrue($this->backend->userExists($user1));
}

public function testDeleteUserInvalidatesCache(): void {
$user1 = $this->getUniqueID('test_');
$user1 = $this->getUser();
$this->backend->createUser($user1, 'pw');
$this->assertTrue($this->backend->userExists($user1));
$this->backend->deleteUser($user1);
Expand Down
Loading