Skip to content

Commit 9fc2e3b

Browse files
committed
Fix some more tests
1 parent 92c110f commit 9fc2e3b

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/Database/Migrations/Install.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -623,14 +623,16 @@ public function createTables(): void
623623
$table->char('uid', 36)->default('0');
624624
});
625625

626-
Schema::create('sessions', function (Blueprint $table) {
627-
$table->string('id')->primary();
628-
$table->foreignId('user_id')->nullable()->index();
629-
$table->string('ip_address', 45)->nullable();
630-
$table->text('user_agent')->nullable();
631-
$table->longText('payload');
632-
$table->integer('last_activity')->index();
633-
});
626+
if (! Schema::hasTable('sessions')) {
627+
Schema::create('sessions', function (Blueprint $table) {
628+
$table->string('id')->primary();
629+
$table->foreignId('user_id')->nullable()->index();
630+
$table->string('ip_address', 45)->nullable();
631+
$table->text('user_agent')->nullable();
632+
$table->longText('payload');
633+
$table->integer('last_activity')->index();
634+
});
635+
}
634636

635637
Schema::create('shunnedmessages', function (Blueprint $table) {
636638
$table->integer('id', true);

tests/TestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ protected function migrateDatabases()
8383
/** Drop Laravel migrations */
8484
Schema::drop('migrations');
8585
Schema::drop('cache');
86-
Schema::drop('sessions');
8786
Schema::drop('users');
8887

8988
$site = new Site(

yii2-adapter/tests/unit/web/twig/ExtensionTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use craft\web\View;
1818
use CraftCms\Cms\Cms;
1919
use CraftCms\Cms\Edition;
20+
use CraftCms\Cms\Element\Models\Element;
2021
use CraftCms\Cms\Entry\Models\EntryType;
2122
use CraftCms\Cms\Field\MissingField;
2223
use CraftCms\Cms\Field\PlainText;
@@ -71,11 +72,12 @@ public function test_globals(): void
7172
{
7273
// We want web for this part.
7374
Craft::$app->getRequest()->setIsConsoleRequest(false);
74-
$user = new User([
75+
$user = \CraftCms\Cms\User\Models\User::create([
76+
'id' => Element::create(['type' => User::class])->id,
7577
'active' => true,
7678
'firstName' => 'John',
7779
'lastName' => 'Smith',
78-
]);
80+
])->asElement();
7981
Craft::$app->getUser()->setIdentity(new IdentityWrapper($user));
8082
Craft::$app->getRequest()->setRawBody('This is a raw body');
8183

0 commit comments

Comments
 (0)