Skip to content
Merged
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
23 changes: 12 additions & 11 deletions tests/InstallCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@

namespace Esign\InstallCommand\Tests;

use PHPUnit\Framework\Attributes\Test;
use Esign\InstallCommand\Exceptions\CouldNotInstallNodePackagesException;
use Esign\InstallCommand\Tests\Support\InstallCommand;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Process;

class InstallCommandTest extends TestCase
final class InstallCommandTest extends TestCase
{
/** @test */
public function it_can_publish_files()
#[Test]
public function it_can_publish_files(): void
{
$this->artisan(InstallCommand::class);

$this->assertFileExists(app_path('Services/UserService.php'));
}

/** @test */
public function it_can_append_after_the_search_value_in_a_file()
#[Test]
public function it_can_append_after_the_search_value_in_a_file(): void
{
$this->artisan(InstallCommand::class);

Expand All @@ -33,26 +34,26 @@ public function isAdmin(): bool
));
}

/** @test */
public function it_can_install_composer_packages()
#[Test]
public function it_can_install_composer_packages(): void
{
$this->artisan(InstallCommand::class);

Process::assertRan('composer require my/composer-package my/specific-composer-package:^1.0');
Process::assertRan('composer require --dev my/dev-composer-package');
}

/** @test */
public function it_can_throw_an_exception_when_no_package_json_file_is_present()
#[Test]
public function it_can_throw_an_exception_when_no_package_json_file_is_present(): void
{
File::delete(base_path('package.json'));
$command = $this->artisan(InstallCommand::class);

$command->expectsOutput("Could not find package.json file in the root of your project. Please create one using `npm init`");
}

/** @test */
public function it_can_install_node_packages()
#[Test]
public function it_can_install_node_packages(): void
{
$this->artisan(InstallCommand::class);

Expand Down
Loading