Skip to content

Commit

Permalink
fix(tests): Adjust users for test
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Nov 28, 2023
1 parent 8a287a8 commit 8f7f541
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/Integration/Api/ApiV2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
use OCP\DB\QueryBuilder\IQueryBuilder;
use Test\TestCase;

/**
* @group DB
*/
class ApiV2Test extends TestCase {
/** @var GuzzleHttp\Client */
private $http;
Expand Down Expand Up @@ -197,9 +200,23 @@ 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');

// We also have user2 and user3 but those accounts are "deleted"
$user = $userManager->get("user1");
if ($user === null) {
$user = $userManager->createUser("user1", "user1");
}
$user->setDisplayName("User No. 1");

$this->setTestForms();

$qb = TestCase::$realDatabase->getQueryBuilder();
$qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();

// Write our test forms into db
foreach ($this->testForms as $index => $form) {
Expand Down Expand Up @@ -302,7 +319,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')
Expand Down

0 comments on commit 8f7f541

Please sign in to comment.