-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bugfix/lb_secs_as_mins
- Loading branch information
Showing
19 changed files
with
178 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
database/migrations/community/2024_04_13_000000_update_gamedata_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::table('GameData', function (Blueprint $table) { | ||
$table->unsignedBigInteger('ForumTopicID')->change(); | ||
}); | ||
|
||
Schema::table('GameData', function (Blueprint $table) { | ||
$table->foreign('ForumTopicID')->references('ID')->on('ForumTopic')->onDelete('set null'); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table('GameData', function (Blueprint $table) { | ||
$table->dropForeign(['ForumTopicID']); | ||
}); | ||
|
||
Schema::table('GameData', function (Blueprint $table) { | ||
$table->integer('ForumTopicID')->change(); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Feature\Platform\Action; | ||
|
||
use App\Actions\ClearAccountDataAction; | ||
use App\Community\Enums\SubscriptionSubjectType; | ||
use App\Community\Enums\UserGameListType; | ||
use App\Community\Enums\UserRelationship; | ||
use App\Models\MessageThread; | ||
use App\Models\MessageThreadParticipant; | ||
use App\Models\Subscription; | ||
use App\Models\User; | ||
use App\Models\UserGameListEntry; | ||
use App\Models\UserRelation; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Tests\Feature\Platform\Concerns\TestsPlayerAchievements; | ||
use Tests\Feature\Platform\Concerns\TestsPlayerBadges; | ||
use Tests\TestCase; | ||
|
||
class ClearAccountDataTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
use TestsPlayerAchievements; | ||
use TestsPlayerBadges; | ||
|
||
public function testClearsData(): void | ||
{ | ||
/** @var User $user1 */ | ||
$user1 = User::factory()->create(); | ||
/** @var User $user2 */ | ||
$user2 = User::factory()->create(); | ||
|
||
$this->assertNotEquals('', $user2->EmailAddress); | ||
|
||
UserRelation::create([ | ||
'User' => $user1->User, | ||
'user_id' => $user1->id, | ||
'Friend' => $user2->User, | ||
'related_user_id' => $user2->id, | ||
'Friendship' => UserRelationship::Following, | ||
]); | ||
|
||
UserRelation::create([ | ||
'User' => $user2->User, | ||
'user_id' => $user2->id, | ||
'Friend' => $user1->User, | ||
'related_user_id' => $user1->id, | ||
'Friendship' => UserRelationship::Following, | ||
]); | ||
|
||
UserGameListEntry::create([ | ||
'user_id' => $user2->ID, | ||
'type' => UserGameListType::AchievementSetRequest, | ||
'GameID' => 1234, | ||
]); | ||
|
||
Subscription::create([ | ||
'user_id' => $user2->ID, | ||
'subject_type' => SubscriptionSubjectType::GameWall, | ||
'subject_id' => 5, | ||
'state' => true, | ||
]); | ||
|
||
$thread = MessageThread::create([ | ||
'title' => 'Message', | ||
]); | ||
MessageThreadParticipant::create([ | ||
'user_id' => $user1->ID, | ||
'thread_id' => $thread->id, | ||
]); | ||
MessageThreadParticipant::create([ | ||
'user_id' => $user2->ID, | ||
'thread_id' => $thread->id, | ||
]); | ||
|
||
$this->assertEquals(1, UserRelation::where('user_id', $user2->id)->count()); | ||
$this->assertEquals(1, UserRelation::where('related_user_id', $user2->id)->count()); | ||
$this->assertEquals(1, UserGameListEntry::where('user_id', $user2->id)->count()); | ||
$this->assertEquals(1, Subscription::where('user_id', $user2->id)->count()); | ||
$this->assertEquals(1, MessageThreadParticipant::where('user_id', $user2->id)->count()); | ||
|
||
$action = new ClearAccountDataAction(); | ||
$action->execute($user2); | ||
|
||
$this->assertEquals(0, UserRelation::where('user_id', $user2->id)->count()); | ||
$this->assertEquals(0, UserRelation::where('related_user_id', $user2->id)->count()); | ||
$this->assertEquals(0, UserGameListEntry::where('user_id', $user2->id)->count()); | ||
$this->assertEquals(0, Subscription::where('user_id', $user2->id)->count()); | ||
$this->assertEquals(0, MessageThreadParticipant::where('user_id', $user2->id)->count()); | ||
|
||
$user2->refresh(); | ||
$this->assertEquals('', $user2->EmailAddress); | ||
} | ||
} |