Skip to content

Commit

Permalink
use attributes for PHPUnit 10+ support
Browse files Browse the repository at this point in the history
  • Loading branch information
miken32 committed Apr 18, 2024
1 parent 5599b3a commit 3d3ed06
Show file tree
Hide file tree
Showing 15 changed files with 140 additions and 270 deletions.
30 changes: 9 additions & 21 deletions tests/Feature/InNetworkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
use Illuminate\Validation\ValidationException;
use Miken32\Validation\Network\Rules;
use Miken32\Validation\Tests\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;

/**
* @covers \Miken32\Validation\Network\Rules\InNetwork
*/
#[CoversClass(\Miken32\Validation\Network\Rules\InNetwork::class)]
class InNetworkTest extends TestCase
{
/**
* @test
*/
#[Test]
public function stringAccepts(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -36,9 +34,7 @@ public function stringAccepts(): void
);
}

/**
* @test
*/
#[Test]
public function instanceAccepts(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -60,9 +56,7 @@ public function instanceAccepts(): void
);
}

/**
* @test
*/
#[Test]
public function stringRejectsIpv4(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -73,9 +67,7 @@ public function stringRejectsIpv4(): void
);
}

/**
* @test
*/
#[Test]
public function stringRejectsIpv6(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -86,9 +78,7 @@ public function stringRejectsIpv6(): void
);
}

/**
* @test
*/
#[Test]
public function instanceRejectsIpv4(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -99,9 +89,7 @@ public function instanceRejectsIpv4(): void
);
}

/**
* @test
*/
#[Test]
public function instanceRejectsIpv6(): void
{
$this->expectException(ValidationException::class);
Expand Down
30 changes: 9 additions & 21 deletions tests/Feature/IpOrNetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
use Illuminate\Validation\ValidationException;
use Miken32\Validation\Network\Rules;
use Miken32\Validation\Tests\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;

/**
* @covers \Miken32\Validation\Network\Rules\IpOrNet
*/
#[CoversClass(\Miken32\Validation\Network\Rules\IpOrNet::class)]
class IpOrNetTest extends TestCase
{
/**
* @test
*/
#[Test]
public function stringAccepts(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -28,9 +26,7 @@ public function stringAccepts(): void
);
}

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

/**
* @test
*/
#[Test]
public function stringRejectsIpv4(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -57,9 +51,7 @@ public function stringRejectsIpv4(): void
);
}

/**
* @test
*/
#[Test]
public function stringRejectsIpv6(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -70,9 +62,7 @@ public function stringRejectsIpv6(): void
);
}

/**
* @test
*/
#[Test]
public function instanceRejectsIpv4(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -83,9 +73,7 @@ public function instanceRejectsIpv4(): void
);
}

/**
* @test
*/
#[Test]
public function instanceRejectsIpv6(): void
{
$this->expectException(ValidationException::class);
Expand Down
39 changes: 12 additions & 27 deletions tests/Feature/Netv4Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
use Illuminate\Validation\ValidationException;
use Miken32\Validation\Network\Rules;
use Miken32\Validation\Tests\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;

#[CoversClass(\Miken32\Validation\Network\Rules\Netv4::class)]

/**
* @covers \Miken32\Validation\Network\Rules\Netv4
*/
class Netv4Test extends TestCase
{
/**
* @test
*/
#[Test]
public function stringAcceptsBounded(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -24,9 +23,7 @@ public function stringAcceptsBounded(): void
);
}

/**
* @test
*/
#[Test]
public function stringAcceptsUnbounded(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -36,9 +33,7 @@ public function stringAcceptsUnbounded(): void
);
}

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

/**
* @test
*/
#[Test]
public function instanceAcceptsUnbounded(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -60,9 +53,7 @@ public function instanceAcceptsUnbounded(): void
);
}

/**
* @test
*/
#[Test]
public function stringRejectsBounded(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -73,9 +64,7 @@ public function stringRejectsBounded(): void
);
}

/**
* @test
*/
#[Test]
public function stringRejectsUnbounded(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -86,9 +75,7 @@ public function stringRejectsUnbounded(): void
);
}

/**
* @test
*/
#[Test]
public function instanceRejectsBounded(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -99,9 +86,7 @@ public function instanceRejectsBounded(): void
);
}

/**
* @test
*/
#[Test]
public function instanceRejectsUnbounded(): void
{
$this->expectException(ValidationException::class);
Expand Down
38 changes: 11 additions & 27 deletions tests/Feature/Netv6Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
use Illuminate\Validation\ValidationException;
use Miken32\Validation\Network\Rules;
use Miken32\Validation\Tests\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;

/**
* @covers \Miken32\Validation\Network\Rules\Netv6
*/
#[CoversClass(\Miken32\Validation\Network\Rules\Netv6::class)]
class Netv6Test extends TestCase
{
/**
* @test
*/
#[Test]
public function stringAcceptsBounded(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -24,9 +22,7 @@ public function stringAcceptsBounded(): void
);
}

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

/**
* @test
*/
#[Test]
public function instanceAcceptsBounded(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -48,9 +42,7 @@ public function instanceAcceptsBounded(): void
);
}

/**
* @test
*/
#[Test]
public function instanceAcceptsUnbounded(): void
{
$this->expectNotToPerformAssertions();
Expand All @@ -60,9 +52,7 @@ public function instanceAcceptsUnbounded(): void
);
}

/**
* @test
*/
#[Test]
public function stringRejectsBounded(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -73,9 +63,7 @@ public function stringRejectsBounded(): void
);
}

/**
* @test
*/
#[Test]
public function stringRejectsUnbounded(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -86,9 +74,7 @@ public function stringRejectsUnbounded(): void
);
}

/**
* @test
*/
#[Test]
public function instanceRejectsBounded(): void
{
$this->expectException(ValidationException::class);
Expand All @@ -99,9 +85,7 @@ public function instanceRejectsBounded(): void
);
}

/**
* @test
*/
#[Test]
public function instanceRejectsUnbounded(): void
{
$this->expectException(ValidationException::class);
Expand Down
Loading

0 comments on commit 3d3ed06

Please sign in to comment.