Fixes test for migration publishing.

This commit is contained in:
Italo Israel Baeza Cabrera
2023-02-22 01:56:23 -03:00
parent 0ea8f8d82b
commit 639ca1aa28

View File

@@ -3,6 +3,7 @@
namespace Tests; namespace Tests;
use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\File;
use Illuminate\Support\Fluent; use Illuminate\Support\Fluent;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
@@ -28,19 +29,25 @@ class ServiceProviderTest extends TestCase
); );
} }
/**
* @define-env usesCustomTestTime
*/
public function test_publishes_migrations(): void public function test_publishes_migrations(): void
{ {
$format = now()->format('Y_m_d_His');
static::assertSame( static::assertSame(
[ [
realpath(WebAuthnServiceProvider::MIGRATIONS . '/2022_07_01_000000_create_webauthn_credentials.php') => realpath(WebAuthnServiceProvider::MIGRATIONS . '/2022_07_01_000000_create_webauthn_credentials.php') =>
$this->app->databasePath("migrations/{$format}_create_webauthn_credentials.php"), $this->app->databasePath("migrations/2020_01_01_163025_create_webauthn_credentials.php"),
], ],
ServiceProvider::pathsToPublish(WebAuthnServiceProvider::class, 'migrations') ServiceProvider::pathsToPublish(WebAuthnServiceProvider::class, 'migrations')
); );
} }
protected function usesCustomTestTime()
{
$this->travelTo(Carbon::create(2020, 01, 01, 16, 30, 25));
}
public function test_bounds_user(): void public function test_bounds_user(): void
{ {
static::assertNull($this->app->make(WebAuthnAuthenticatable::class)); static::assertNull($this->app->make(WebAuthnAuthenticatable::class));