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
9 changes: 3 additions & 6 deletions packages/auth/src/Installer/AuthenticationInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
namespace Tempest\Auth\Installer;

use Tempest\Console\Console;
use Tempest\Console\ConsoleCommand;
use Tempest\Console\Input\ConsoleArgumentBag;
use Tempest\Container\Container;
use Tempest\Core\Installer;
use Tempest\Core\PublishesFiles;
use Tempest\Database\Migrations\MigrationManager;

use function Tempest\root_path;
use function Tempest\src_path;
use function Tempest\Support\Namespace\to_fqcn;

if (class_exists(\Tempest\Console\ConsoleCommand::class)) {
if (class_exists(ConsoleCommand::class)) {
final class AuthenticationInstaller implements Installer
{
use PublishesFiles;
Expand All @@ -36,9 +35,7 @@ public function install(): void
$this->publishImports();

if ($migration && $this->shouldMigrate()) {
$this->migrationManager->executeUp(
migration: $this->container->get(to_fqcn($migration, root: root_path())),
);
$this->migrationManager->up();
}

if ($this->shouldInstallOAuth()) {
Expand Down
40 changes: 40 additions & 0 deletions tests/Integration/Auth/Installer/AuthenticationInstallerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Integration\Auth\Installer;

use PHPUnit\Framework\Attributes\Test;
use Tempest\Support\Namespace\Psr4Namespace;
use Tests\Tempest\Integration\FrameworkIntegrationTestCase;

final class AuthenticationInstallerTest extends FrameworkIntegrationTestCase
{
protected function setUp(): void
{
parent::setUp();

$this->installer
->configure(
__DIR__ . '/install',
new Psr4Namespace('App\\', __DIR__ . '/install/App'),
)
->setRoot(__DIR__ . '/install')
->put('.env.example', '')
->put('.env', '');
}

protected function tearDown(): void
{
$this->installer->clean();

parent::tearDown();
}

#[Test]
public function install_oauth_provider_with_migrations(): void
{
$this->console
->call('install auth --force --migrate')
->input(0)
->assertSuccess();
}
}