Skip to content

Commit 2da5e83

Browse files
committed
test: use dummy users in SharesReminderJobTest
saves ~5s Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 7f08204 commit 2da5e83

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

apps/files_sharing/tests/SharesReminderJobTest.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use OCP\Share\IShare;
2626
use PHPUnit\Framework\MockObject\MockObject;
2727
use Psr\Log\LoggerInterface;
28+
use Test\Traits\UserTrait;
2829

2930
/**
3031
* Class SharesReminderJobTest
@@ -34,6 +35,8 @@
3435
*/
3536
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
3637
class SharesReminderJobTest extends \Test\TestCase {
38+
use UserTrait;
39+
3740
private SharesReminderJob $job;
3841
private IDBConnection $db;
3942
private IManager $shareManager;
@@ -56,8 +59,8 @@ protected function setUp(): void {
5659
$this->user1 = $this->getUniqueID('user1_');
5760
$this->user2 = $this->getUniqueID('user2_');
5861

59-
$user1 = $this->userManager->createUser($this->user1, 'longrandompassword');
60-
$user2 = $this->userManager->createUser($this->user2, 'longrandompassword');
62+
$user1 = $this->createUser($this->user1, 'longrandompassword');
63+
$user2 = $this->createUser($this->user2, 'longrandompassword');
6164
$user1->setSystemEMailAddress('user1@test.com');
6265
$user2->setSystemEMailAddress('user2@test.com');
6366

@@ -80,16 +83,6 @@ protected function setUp(): void {
8083
protected function tearDown(): void {
8184
$this->db->executeUpdate('DELETE FROM `*PREFIX*share`');
8285

83-
$userManager = Server::get(IUserManager::class);
84-
$user1 = $userManager->get($this->user1);
85-
if ($user1) {
86-
$user1->delete();
87-
}
88-
$user2 = $userManager->get($this->user2);
89-
if ($user2) {
90-
$user2->delete();
91-
}
92-
9386
$this->logout();
9487

9588
parent::tearDown();

0 commit comments

Comments
 (0)