File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed
yii2-adapter/tests/unit/web/twig Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff 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 (
Original file line number Diff line number Diff line change 1717use craft \web \View ;
1818use CraftCms \Cms \Cms ;
1919use CraftCms \Cms \Edition ;
20+ use CraftCms \Cms \Element \Models \Element ;
2021use CraftCms \Cms \Entry \Models \EntryType ;
2122use CraftCms \Cms \Field \MissingField ;
2223use 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
You can’t perform that action at this time.
0 commit comments