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
5 changes: 2 additions & 3 deletions src/Generators/PhpUnitTestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function output(Tree $tree): array
/** @var \Blueprint\Models\Controller $controller */
foreach ($tree->controllers() as $controller) {
$this->addImport($controller, \Tests\TestCase::class);
$this->addImport($controller, 'PHPUnit\Framework\Attributes\Test');

$path = $this->getPath($controller);

Expand Down Expand Up @@ -531,9 +532,7 @@ private function buildFormRequestName(Controller $controller, string $name)
private function buildFormRequestTestCase(string $controller, string $action, string $form_request)
{
return <<< END
/**
* @test
*/
#[Test]
public function ${action}_uses_form_request_validation(): void
{
\$this->assertActionUsesFormRequest(
Expand Down
4 changes: 1 addition & 3 deletions stubs/phpunit.test.case.stub
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/**
* @test
*/
#[Test]
public function {{ method }}(): void
{
{{ body }}
Expand Down
2 changes: 1 addition & 1 deletion stubs/phpunit.test.class.stub
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace {{ namespace }};
/**
* @see {{ namespacedClass }}
*/
class {{ class }} extends TestCase
final class {{ class }} extends TestCase
{
{{ body }}
}
5 changes: 3 additions & 2 deletions tests/Feature/Commands/BuildCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
use Blueprint\Blueprint;
use Blueprint\Builder;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[CoversClass(\Blueprint\Commands\BuildCommand::class)]
/**
* @see \Blueprint\Commands\BuildCommand
*/
final class BuildCommandTest extends TestCase
{
use MockeryPHPUnitIntegration;
Expand Down
5 changes: 3 additions & 2 deletions tests/Feature/Commands/EraseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
use Blueprint\Blueprint;
use Blueprint\Tracer;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[CoversClass(\Blueprint\Commands\EraseCommand::class)]
/**
* @see \Blueprint\Commands\EraseCommand
*/
final class EraseCommandTest extends TestCase
{
use MockeryPHPUnitIntegration;
Expand Down
5 changes: 3 additions & 2 deletions tests/Feature/Commands/InitCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Tests\Feature\Commands;

use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[CoversClass(\Blueprint\Commands\InitCommand::class)]
/**
* @see \Blueprint\Commands\InitCommand
*/
final class InitCommandTest extends TestCase
{
use MockeryPHPUnitIntegration;
Expand Down
5 changes: 3 additions & 2 deletions tests/Feature/Commands/NewCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Tests\Feature\Commands;

use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[CoversClass(\Blueprint\Commands\NewCommand::class)]
/**
* @see \Blueprint\Commands\NewCommand
*/
final class NewCommandTest extends TestCase
{
use MockeryPHPUnitIntegration;
Expand Down
5 changes: 3 additions & 2 deletions tests/Feature/Commands/TraceCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
use Blueprint\Builder;
use Blueprint\Tracer;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\Yaml\Yaml;
use Tests\TestCase;

#[CoversClass(\Blueprint\Commands\TraceCommand::class)]
/**
* @see \Blueprint\Commands\TraceCommand
*/
final class TraceCommandTest extends TestCase
{
use MockeryPHPUnitIntegration;
Expand Down
5 changes: 3 additions & 2 deletions tests/Unit/EnumTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Tests\Unit;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[CoversClass(\Blueprint\EnumType::class)]
/**
* @see \Blueprint\EnumType
*/
final class EnumTypeTest extends TestCase
{
#[Test]
Expand Down
5 changes: 3 additions & 2 deletions tests/Unit/TreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use Blueprint\Tree;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[CoversClass(\Blueprint\Tree::class)]
/**
* @see \Blueprint\Tree
*/
final class TreeTest extends TestCase
{
#[Test]
Expand Down
31 changes: 9 additions & 22 deletions tests/fixtures/tests/phpunit/api-shorthand-validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use JMac\Testing\Traits\AdditionalAssertions;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

/**
* @see \App\Http\Controllers\CertificateController
*/
class CertificateControllerTest extends TestCase
final class CertificateControllerTest extends TestCase
{
use AdditionalAssertions, RefreshDatabase, WithFaker;

/**
* @test
*/
#[Test]
public function index_behaves_as_expected(): void
{
$certificates = Certificate::factory()->count(3)->create();
Expand All @@ -31,9 +30,7 @@ public function index_behaves_as_expected(): void
}


/**
* @test
*/
#[Test]
public function store_uses_form_request_validation(): void
{
$this->assertActionUsesFormRequest(
Expand All @@ -43,9 +40,7 @@ public function store_uses_form_request_validation(): void
);
}

/**
* @test
*/
#[Test]
public function store_saves(): void
{
$name = $this->faker->name;
Expand Down Expand Up @@ -77,9 +72,7 @@ public function store_saves(): void
}


/**
* @test
*/
#[Test]
public function show_behaves_as_expected(): void
{
$certificate = Certificate::factory()->create();
Expand All @@ -91,9 +84,7 @@ public function show_behaves_as_expected(): void
}


/**
* @test
*/
#[Test]
public function update_uses_form_request_validation(): void
{
$this->assertActionUsesFormRequest(
Expand All @@ -103,9 +94,7 @@ public function update_uses_form_request_validation(): void
);
}

/**
* @test
*/
#[Test]
public function update_behaves_as_expected(): void
{
$certificate = Certificate::factory()->create();
Expand Down Expand Up @@ -136,9 +125,7 @@ public function update_behaves_as_expected(): void
}


/**
* @test
*/
#[Test]
public function destroy_deletes_and_responds_with(): void
{
$certificate = Certificate::factory()->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Mail;
use JMac\Testing\Traits\AdditionalAssertions;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

/**
* @see \App\Http\Controllers\Api\PaymentController
*/
class PaymentControllerTest extends TestCase
final class PaymentControllerTest extends TestCase
{
use AdditionalAssertions, RefreshDatabase, WithFaker;

/**
* @test
*/
#[Test]
public function store_uses_form_request_validation(): void
{
$this->assertActionUsesFormRequest(
Expand All @@ -32,9 +31,7 @@ public function store_uses_form_request_validation(): void
);
}

/**
* @test
*/
#[Test]
public function store_saves_and_responds_with(): void
{
$status = $this->faker->word;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Mail;
use JMac\Testing\Traits\AdditionalAssertions;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

/**
* @see \App\Http\Controllers\PaymentController
*/
class PaymentControllerTest extends TestCase
final class PaymentControllerTest extends TestCase
{
use AdditionalAssertions, RefreshDatabase, WithFaker;

/**
* @test
*/
#[Test]
public function create_displays_view(): void
{
$response = $this->get(route('payment.create'));
Expand All @@ -32,9 +31,7 @@ public function create_displays_view(): void
}


/**
* @test
*/
#[Test]
public function store_uses_form_request_validation(): void
{
$this->assertActionUsesFormRequest(
Expand All @@ -44,9 +41,7 @@ public function store_uses_form_request_validation(): void
);
}

/**
* @test
*/
#[Test]
public function store_saves_and_redirects(): void
{
$status = $this->faker->word;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@

use App\Models\Subscription;
use Illuminate\Foundation\Testing\RefreshDatabase;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

/**
* @see \App\Http\Controllers\SubscriptionController
*/
class SubscriptionControllerTest extends TestCase
final class SubscriptionControllerTest extends TestCase
{
use RefreshDatabase;

/**
* @test
*/
#[Test]
public function index_displays_view(): void
{
$subscriptions = Subscription::factory()->count(3)->create();
Expand All @@ -28,9 +27,7 @@ public function index_displays_view(): void
}


/**
* @test
*/
#[Test]
public function show_displays_view(): void
{
$subscription = Subscription::factory()->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Tests\Feature\Http\Controllers;

use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

/**
* @see \App\Http\Controllers\TelegramController
*/
class TelegramControllerTest extends TestCase
final class TelegramControllerTest extends TestCase
{

}
Loading