Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}
},
"require": {
"saucebase/core": "^2.8",
"saucebase/core": "^2.8.1",
"laravel/socialite": "^5.31",
"stechstudio/filament-impersonate": "^5.6.1",
"laravel/passkeys": "^0.2.1"
Expand Down
11 changes: 5 additions & 6 deletions patches/user.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
+use Laravel\Passkeys\PasskeyAuthenticatable;
+use Modules\Auth\Traits\Sociable;
use Saucebase\Core\Settings\LocalizationSettings;
@@ -17,3 +20,3 @@

-class User extends Authenticatable implements FilamentUser, HasLocalePreference, HasMedia
+class User extends Authenticatable implements FilamentUser, HasLocalePreference, HasMedia, PasskeyUser
// , MustVerifyEmail
@@ -24,2 +27,4 @@
@@ -21,2 +24,3 @@
HasLocalePreference,
+ PasskeyUser,
HasMedia
@@ -28,2 +32,4 @@
use Notifiable;
+ use PasskeyAuthenticatable;
+ use Sociable;
Expand Down
39 changes: 39 additions & 0 deletions tests/Feature/UserPatchTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Modules\Auth\Tests\Feature;

use Illuminate\Support\Facades\File;
use Symfony\Component\Process\Process;
use Tests\TestCase;

/**
* Other modules patch the same User model, in any order, so this patch may only add
* lines: an edited line is one another module's patch no longer finds. And it must
* apply to the User core ships.
*/
class UserPatchTest extends TestCase
{
private const PATCH = __DIR__.'/../../patches/user.patch';

public function test_it_only_adds_lines(): void
{
$removed = preg_grep('/^-(?!--)/', file(self::PATCH, FILE_IGNORE_NEW_LINES) ?: []);

$this->assertSame([], array_values($removed));
}

public function test_it_applies_to_the_user_core_ships(): void
{
$app = sys_get_temp_dir().'/user-patch-'.uniqid();
File::ensureDirectoryExists($app.'/app/Models');
File::copy(base_path('vendor/saucebase/core/stubs/app/app/Models/User.php'), $app.'/app/Models/User.php');

try {
$apply = new Process(['git', 'apply', '--check', realpath(self::PATCH)], $app);

$this->assertSame(0, $apply->run(), $apply->getErrorOutput());
} finally {
File::deleteDirectory($app);
}
}
}
Loading