Skip to content

Commit

Permalink
bot: fix cs [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
nikophil authored and kbond committed Dec 4, 2024
1 parent 0867ad6 commit d629c13
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
20 changes: 6 additions & 14 deletions src/PHPUnit/BuildStoryOnTestPrepared.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public function notify(Event\Test\Prepared $event): void
}

/** @var Event\Code\TestMethod $test */

$reflectionClass = new \ReflectionClass($test->className());
$withStoryAttributes = [
...$this->collectWithStoryAttributesFromClassAndParents($reflectionClass),
Expand All @@ -43,15 +42,8 @@ public function notify(Event\Test\Prepared $event): void
return;
}

if (!is_subclass_of($test->className(), KernelTestCase::class)) {
throw new \InvalidArgumentException(
\sprintf(
'The test class "%s" must extend "%s" to use the "%s" attribute.',
$test->className(),
KernelTestCase::class,
WithStory::class
)
);
if (!\is_subclass_of($test->className(), KernelTestCase::class)) {
throw new \InvalidArgumentException(\sprintf('The test class "%s" must extend "%s" to use the "%s" attribute.', $test->className(), KernelTestCase::class, WithStory::class));
}

foreach ($withStoryAttributes as $withStoryAttribute) {
Expand All @@ -67,10 +59,10 @@ private function collectWithStoryAttributesFromClassAndParents(\ReflectionClass
return [
...$class->getAttributes(WithStory::class),
...(
$class->getParentClass()
? $this->collectWithStoryAttributesFromClassAndParents($class->getParentClass())
: []
)
$class->getParentClass()
? $this->collectWithStoryAttributesFromClassAndParents($class->getParentClass())
: []
),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the zenstruck/foundry package.
*
* (c) Kevin Bond <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Zenstruck\Foundry\Tests\Integration\Attribute\WithStory;

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
Expand All @@ -17,5 +26,5 @@
#[WithStory(EntityStory::class)]
abstract class ParentClassWithStoryAttributeTestCase extends KernelTestCase
{
use Factories, ResetDatabase, RequiresORM;
use Factories, RequiresORM, ResetDatabase;
}
11 changes: 10 additions & 1 deletion tests/Integration/Attribute/WithStory/WithStoryOnClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the zenstruck/foundry package.
*
* (c) Kevin Bond <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Zenstruck\Foundry\Tests\Integration\Attribute\WithStory;

use PHPUnit\Framework\Attributes\RequiresPhpunit;
Expand All @@ -25,7 +34,7 @@
#[WithStory(EntityStory::class)]
final class WithStoryOnClassTest extends KernelTestCase
{
use Factories, ResetDatabase, RequiresORM;
use Factories, RequiresORM, ResetDatabase;

/**
* @test
Expand Down
11 changes: 10 additions & 1 deletion tests/Integration/Attribute/WithStory/WithStoryOnMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the zenstruck/foundry package.
*
* (c) Kevin Bond <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Zenstruck\Foundry\Tests\Integration\Attribute\WithStory;

use PHPUnit\Framework\Attributes\RequiresPhpunit;
Expand All @@ -25,7 +34,7 @@
#[RequiresPhpunitExtension(FoundryExtension::class)]
final class WithStoryOnMethodTest extends KernelTestCase
{
use Factories, ResetDatabase, RequiresORM;
use Factories, RequiresORM, ResetDatabase;

/**
* @test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the zenstruck/foundry package.
*
* (c) Kevin Bond <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Zenstruck\Foundry\Tests\Integration\Attribute\WithStory;

use PHPUnit\Framework\Attributes\RequiresPhpunit;
Expand Down

0 comments on commit d629c13

Please sign in to comment.