From 5dab23463049151c80ab3340c36d4f47d2eaaddb Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 27 Jan 2020 13:00:09 +0000 Subject: [PATCH] create test users individually --- tests/bootstrap.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 2d013dc1..428383ec 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,12 +10,17 @@ $_SERVER['QUERY_STRING'] = '/'; chdir(dirname(dirname(__FILE__))); require_once "core/_bootstrap.php"; -if (is_null(User::by_name("demo"))) { - $userPage = new UserPage(); - $userPage->onUserCreation(new UserCreationEvent("demo", "demo", "")); - $userPage->onUserCreation(new UserCreationEvent("test", "test", "")); +function create_user(string $name) { + if (is_null(User::by_name($name))) { + $userPage = new UserPage(); + $userPage->onUserCreation(new UserCreationEvent($name, $name, "")); + assert(!is_null(User::by_name($name)), "Creation of user $name failed"); + } } +create_user("demo"); +create_user("test"); + abstract class ShimmiePHPUnitTestCase extends \PHPUnit\Framework\TestCase { private $images = [];