Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Oct 23, 2023
1 parent 642a966 commit 2eca627
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
13 changes: 7 additions & 6 deletions tests/Commands/GeneratorCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Orchestra\Testbench\Concerns\InteractsWithPublishedFiles;
use Orchestra\Testbench\Concerns\WithWorkbench;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\Test;

class GeneratorCommandTest extends TestCase
{
Expand All @@ -16,7 +17,7 @@ class GeneratorCommandTest extends TestCase
'tests/Feature/Value/FooTest.php',
];

/** @test */
#[Test]
public function it_can_generate_class_file()
{
$this->artisan('make:code', ['name' => 'Value/Foo'])
Expand All @@ -28,7 +29,7 @@ public function it_can_generate_class_file()
], 'app/Value/Foo.php');
}

/** @test */
#[Test]
public function it_can_generate_class_file_with_phpunit_test()
{
$this->artisan('make:code', ['name' => 'Value/Foo', '--test' => true])
Expand All @@ -46,7 +47,7 @@ public function it_can_generate_class_file_with_phpunit_test()
], 'tests/Feature/Value/FooTest.php');
}

/** @test */
#[Test]
public function it_can_generate_class_file_with_pest_test()
{
$this->artisan('make:code', ['name' => 'Value/Foo', '--pest' => true])
Expand All @@ -64,7 +65,7 @@ public function it_can_generate_class_file_with_pest_test()
], 'tests/Feature/Value/FooTest.php');
}

/** @test */
#[Test]
public function it_can_generate_class_file_when_file_already_exist_using_force_option()
{
file_put_contents(base_path('app/Value/Foo.php'), '<?php '.PHP_EOL);
Expand All @@ -78,15 +79,15 @@ public function it_can_generate_class_file_when_file_already_exist_using_force_o
], 'app/Value/Foo.php');
}

/** @test */
#[Test]
public function it_cannot_generate_class_file_given_reserved_name()
{
$this->artisan('make:code', ['name' => '__halt_compiler'])
->expectsOutputToContain('The name "__halt_compiler" is reserved by PHP.')
->assertFailed();
}

/** @test */
#[Test]
public function it_cannot_generate_class_file_when_file_already_exist()
{
file_put_contents(base_path('app/Value/Foo.php'), '<?php '.PHP_EOL);
Expand Down
3 changes: 2 additions & 1 deletion tests/Concerns/UsesGeneratorOverridesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Orchestra\Canvas\Core\PresetManager;
use Orchestra\Canvas\Core\Presets\Preset;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\Test;

class UsesGeneratorOverridesTest extends TestCase
{
Expand All @@ -31,7 +32,7 @@ protected function setUp(): void
parent::setUp();
}

/** @test */
#[Test]
public function it_can_get_qualify_model_class()
{
$stub = new UsesGeneratorOverridesTestStub();
Expand Down
5 changes: 3 additions & 2 deletions tests/PresetManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
use Illuminate\Support\Manager;
use Orchestra\Canvas\Core\PresetManager;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\Test;

class PresetManagerTest extends TestCase
{
/** @test */
#[Test]
public function it_can_be_resolved()
{
$manager = $this->app[PresetManager::class];
Expand All @@ -17,7 +18,7 @@ public function it_can_be_resolved()
$this->assertSame('laravel', $manager->getDefaultDriver());
}

/** @test */
#[Test]
public function it_can_override_default_driver()
{
$manager = $this->app[PresetManager::class];
Expand Down
5 changes: 3 additions & 2 deletions tests/Presets/LaravelPresetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Orchestra\Canvas\Core\Presets\Laravel;
use Orchestra\Testbench\Concerns\WithWorkbench;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\Test;

class LaravelPresetTest extends TestCase
{
Expand All @@ -32,7 +33,7 @@ protected function setUp(): void
parent::setUp();
}

/** @test */
#[Test]
public function it_can_be_resolved()
{
$preset = $this->app[PresetManager::class]->driver('laravel');
Expand Down Expand Up @@ -62,7 +63,7 @@ public function it_can_be_resolved()
$this->assertSame('Illuminate\Foundation\Auth\User', $preset->userProviderModel());
}

/** @test */
#[Test]
public function it_available_as_default_driver()
{
$preset = $this->app[PresetManager::class]->driver();
Expand Down

0 comments on commit 2eca627

Please sign in to comment.