Skip to content

Commit

Permalink
Use attributes in phpunit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
magicsunday committed Aug 2, 2024
1 parent 51f9780 commit a73bbaf
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 86 deletions.
5 changes: 3 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ parameters:
- %currentWorkingDirectory%/test/
- %currentWorkingDirectory%/.build/

# Ignored validations
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
-
identifier: missingType.generics
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
SetList::CODING_STYLE,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_74,
LevelSetList::UP_TO_PHP_81,
]);

// Skip some rules
Expand Down
2 changes: 1 addition & 1 deletion src/JsonMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private function getReflectionProperty(string $className, string $propertyName):
{
try {
return new ReflectionProperty($className, $propertyName);
} catch (ReflectionException $exception) {
} catch (ReflectionException) {
return null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/Annotation/ReplacePropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use MagicSunday\Test\Classes\ReplacePropertyTestClass;
use MagicSunday\Test\TestCase;
use PHPUnit\Framework\Attributes\Test;

/**
* Class ReplacePropertyTest.
Expand All @@ -25,9 +26,8 @@ class ReplacePropertyTest extends TestCase
{
/**
* Tests replacing a property.
*
* @test
*/
#[Test]
public function replaceProperty(): void
{
$result = $this->getJsonMapper()
Expand Down
4 changes: 2 additions & 2 deletions test/Converter/CamelCasePropertyNameConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace MagicSunday\Test\Converter;

use MagicSunday\JsonMapper\Converter\CamelCasePropertyNameConverter;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -25,9 +26,8 @@ class CamelCasePropertyNameConverterTest extends TestCase
{
/**
* Tests mapping json properties to camel case.
*
* @test
*/
#[Test]
public function checkCamelCasePropertyNameConverter(): void
{
$converter = new CamelCasePropertyNameConverter();
Expand Down
Loading

0 comments on commit a73bbaf

Please sign in to comment.