Skip to content

Commit 7bff945

Browse files
authored
PHPUnit - Migrate from Doc Comment Configuration (rappasoft#1727)
* Migrate from Doc Comments to Attributes for PHPUnit --------- Co-authored-by: lrljoe <[email protected]>
1 parent 1a15be7 commit 7bff945

File tree

75 files changed

+852
-1795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+852
-1795
lines changed

tests/DataTableComponentTest.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
class DataTableComponentTest extends TestCase
1111
{
12-
/** @test */
13-
public function primary_key_can_be_set(): void
12+
public function test_primary_key_can_be_set(): void
1413
{
1514
$this->assertSame('id', $this->basicTable->getPrimaryKey());
1615

@@ -19,8 +18,7 @@ public function primary_key_can_be_set(): void
1918
$this->assertSame('name', $this->basicTable->getPrimaryKey());
2019
}
2120

22-
/** @test */
23-
public function primary_key_can_be_checked_for_existence(): void
21+
public function test_primary_key_can_be_checked_for_existence(): void
2422
{
2523
$this->assertTrue($this->basicTable->hasPrimaryKey());
2624

@@ -29,16 +27,14 @@ public function primary_key_can_be_checked_for_existence(): void
2927
$this->assertFalse($this->basicTable->hasPrimaryKey());
3028
}
3129

32-
/** @test */
33-
public function primary_key_has_to_be_set(): void
30+
public function test_primary_key_has_to_be_set(): void
3431
{
3532
$this->expectException(\Illuminate\View\ViewException::class);
3633
Livewire::test(NoPrimaryKeyTable::class)
3734
->call('setSearch', 'abcd');
3835
}
3936

40-
/** @test */
41-
public function default_fingerprint_will_always_be_the_same_for_same_datatable(): void
37+
public function test_default_fingerprint_will_always_be_the_same_for_same_datatable(): void
4238
{
4339
$this->assertSame(
4440
[
@@ -57,8 +53,7 @@ public function default_fingerprint_will_always_be_the_same_for_same_datatable()
5753

5854
}
5955

60-
/** @test */
61-
public function default_datatable_fingerprints_will_be_different_for_each_table(): void
56+
public function test_default_datatable_fingerprints_will_be_different_for_each_table(): void
6257
{
6358
$mockTable = new class() extends PetsTable
6459
{
@@ -67,8 +62,7 @@ public function default_datatable_fingerprints_will_be_different_for_each_table(
6762
$this->assertNotSame($this->basicTable->getDataTableFingerprint(), $mockTable->getDataTableFingerprint());
6863
}
6964

70-
/** @test */
71-
public function default_fingerprint_will_be_url_friendy(): void
65+
public function test_default_fingerprint_will_be_url_friendy(): void
7266
{
7367
$mocks = [];
7468
for ($i = 0; $i < 9; $i++) {
@@ -81,8 +75,7 @@ public function default_fingerprint_will_be_url_friendy(): void
8175
$this->assertTrue(filter_var('http://[9/$].dev', FILTER_VALIDATE_URL) === false);
8276
}
8377

84-
/** @test */
85-
public function minimum_one_column_expected(): void
78+
public function test_minimum_one_column_expected(): void
8679
{
8780
$this->expectException(\Rappasoft\LaravelLivewireTables\Exceptions\NoColumnsException::class);
8881
$table = new NoColumnsTable();

tests/DataTransferObjects/DebuggableDataTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,18 @@
55
use Rappasoft\LaravelLivewireTables\DataTransferObjects\DebuggableData;
66
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
77

8-
class DebuggableDataTest extends TestCase
8+
final class DebuggableDataTest extends TestCase
99
{
10-
/** @test */
1110
public function test_example()
1211
{
1312
$this->assertTrue(true);
1413
}
1514

16-
/** @test */
1715
public function test_example2()
1816
{
1917
$this->assertSame($this->basicTable->sortBy('id'), 'asc');
2018
}
2119

22-
/** @test */
2320
public function test_check_all_default_dto_elements()
2421
{
2522
$debuggableDTO = new DebuggableData($this->basicTable);
@@ -34,7 +31,6 @@ public function test_check_all_default_dto_elements()
3431
$this->assertSame($debuggableArray['selected'], []);
3532
}
3633

37-
/** @test */
3834
public function test_check_dto_returns_filters_correctly()
3935
{
4036
$debuggableDTO = new DebuggableData($this->basicTable);

tests/Events/ColumnsSelectedTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55
use Illuminate\Support\Facades\Event;
66
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
77

8-
class ColumnsSelectedTest extends TestCase
8+
final class ColumnsSelectedTest extends TestCase
99
{
10-
/** @test */
1110
public function test_example()
1211
{
1312
$this->assertTrue(true);
1413
}
1514

16-
/** @test */
1715
/* Temporary Removal - Suitable Replacement Inbound */
1816
/*
19-
public function an_event_is_emitted_when_a_column_selection_are_updated()
17+
public function test_an_event_is_emitted_when_a_column_selection_are_updated()
2018
{
2119
Event::fake([
2220
ColumnsSelected::class,

tests/Features/AutoInjectRappasoftAssetsTest.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
use Rappasoft\LaravelLivewireTables\Features\AutoInjectRappasoftAssets;
66
use Rappasoft\LaravelLivewireTables\Tests\TestCase;
77

8-
class AutoInjectRappasoftAssetsTest extends TestCase
8+
final class AutoInjectRappasoftAssetsTest extends TestCase
99
{
10-
/** @test */
11-
public function shouldInjectRappasoftAndThirdParty()
10+
public function test_shouldInjectRappasoftAndThirdParty()
1211
{
1312
config()->set('livewire-tables.inject_core_assets_enabled', true);
1413
config()->set('livewire-tables.inject_third_party_assets_enabled', true);
@@ -21,8 +20,7 @@ public function shouldInjectRappasoftAndThirdParty()
2120
$this->assertStringContainsStringIgnoringCase('<script src="/rappasoft/laravel-livewire-tables/thirdparty.min.js" ></script>', $injectionReturn);
2221
}
2322

24-
/** @test */
25-
public function shouldNotInjectRappasoftOrThirdParty()
23+
public function test_shouldNotInjectRappasoftOrThirdParty()
2624
{
2725
config()->set('livewire-tables.inject_core_assets_enabled', false);
2826
config()->set('livewire-tables.inject_third_party_assets_enabled', false);
@@ -32,8 +30,7 @@ public function shouldNotInjectRappasoftOrThirdParty()
3230
$this->assertEquals('<html><head> </head><body></body></html>', AutoInjectRappasoftAssets::injectAssets('<html><head></head><body></body></html>'));
3331
}
3432

35-
/** @test */
36-
public function shouldOnlyInjectThirdParty()
33+
public function test_shouldOnlyInjectThirdParty()
3734
{
3835
config()->set('livewire-tables.inject_core_assets_enabled', false);
3936
config()->set('livewire-tables.inject_third_party_assets_enabled', true);
@@ -44,8 +41,7 @@ public function shouldOnlyInjectThirdParty()
4441
$this->assertStringContainsStringIgnoringCase('<script src="/rappasoft/laravel-livewire-tables/thirdparty.min.js" ></script>', $injectionReturn);
4542
}
4643

47-
/** @test */
48-
public function shouldOnlyInjectRappasoft()
44+
public function test_shouldOnlyInjectRappasoft()
4945
{
5046
config()->set('livewire-tables.inject_core_assets_enabled', true);
5147
config()->set('livewire-tables.inject_third_party_assets_enabled', false);

0 commit comments

Comments
 (0)