Skip to content

Commit

Permalink
minor: add phpunit attributes (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikophil authored Mar 29, 2024
1 parent 90cc839 commit ec2c895
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ parameters:
- message: '#Return type of call to function Zenstruck\\Foundry\\Persistence\\proxy contains unresolvable type#'
path: src/Persistence/ProxyRepositoryDecorator.php

- message: '#Attribute class PHPUnit\\Framework\\Attributes\\(.*) does not exist.#'

excludePaths:
- tests/Fixture/Maker/expected/can_create_factory_interactively.php
- tests/Fixture/Maker/expected/can_create_factory_with_embeddable_with_data_set_odm.php
Expand Down
4 changes: 4 additions & 0 deletions src/Test/Factories.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Zenstruck\Foundry\Test;

use PHPUnit\Framework\Attributes\After;
use PHPUnit\Framework\Attributes\Before;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Zenstruck\Foundry\Configuration;

Expand All @@ -23,6 +25,7 @@ trait Factories
* @internal
* @before
*/
#[Before]
public static function _bootFoundry(): void
{
if (!\is_subclass_of(static::class, KernelTestCase::class)) { // @phpstan-ignore-line
Expand All @@ -47,6 +50,7 @@ public static function _bootFoundry(): void
* @internal
* @after
*/
#[After]
public static function _shutdownFoundry(): void
{
Configuration::shutdown();
Expand Down
4 changes: 4 additions & 0 deletions src/Test/ResetDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Zenstruck\Foundry\Test;

use PHPUnit\Framework\Attributes\Before;
use PHPUnit\Framework\Attributes\BeforeClass;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Zenstruck\Foundry\Persistence\PersistenceManager;

Expand All @@ -23,6 +25,7 @@ trait ResetDatabase
* @internal
* @beforeClass
*/
#[BeforeClass]
public static function _resetDatabase(): void
{
if (!\is_subclass_of(static::class, KernelTestCase::class)) {
Expand All @@ -39,6 +42,7 @@ public static function _resetDatabase(): void
* @internal
* @before
*/
#[Before]
public static function _resetSchema(): void
{
if (!\is_subclass_of(static::class, KernelTestCase::class)) {
Expand Down

0 comments on commit ec2c895

Please sign in to comment.