diff --git a/tests/Integration/Api/ApiV2Test.php b/tests/Integration/Api/ApiV2Test.php index b6dc23bbc..3e538a53a 100644 --- a/tests/Integration/Api/ApiV2Test.php +++ b/tests/Integration/Api/ApiV2Test.php @@ -33,6 +33,9 @@ use OCP\DB\QueryBuilder\IQueryBuilder; use Test\TestCase; +/** + * @group DB + */ class ApiV2Test extends TestCase { /** @var GuzzleHttp\Client */ private $http; @@ -197,9 +200,24 @@ private function setTestForms() { */ public function setUp(): void { parent::setUp(); + $userManager = \OC::$server->getUserManager(); + $user = $userManager->get('test'); + if ($user === null) { + $user = $userManager->createUser('test', 'test'); + } + $user->setDisplayName('Test Displayname'); + + foreach ([1, 2, 3] as $number) { + $user = $userManager->get("user$number"); + if ($user === null) { + $user = $userManager->createUser("user$number", "user$number"); + } + $user->setDisplayName("User No. $number"); + } + $this->setTestForms(); - $qb = TestCase::$realDatabase->getQueryBuilder(); + $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); // Write our test forms into db foreach ($this->testForms as $index => $form) { @@ -302,7 +320,7 @@ public function setUp(): void { /** Clean up database from testforms */ public function tearDown(): void { - $qb = TestCase::$realDatabase->getQueryBuilder(); + $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); foreach ($this->testForms as $form) { $qb->delete('forms_v2_forms') @@ -1137,7 +1155,7 @@ public function dataGetSubmissions() { [ // 'formId' => Checked dynamically 'userId' => 'user2', - 'userDisplayName' => 'user2', + 'userDisplayName' => 'User No. 2', 'timestamp' => 12345, 'answers' => [ [ @@ -1155,7 +1173,7 @@ public function dataGetSubmissions() { [ // 'formId' => Checked dynamically 'userId' => 'user3', - 'userDisplayName' => 'user3', + 'userDisplayName' => 'User No. 3', 'timestamp' => 1234, 'answers' => [ [