Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
cerbero90 committed Jan 12, 2025
1 parent ae754d1 commit 16acb3b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
14 changes: 6 additions & 8 deletions tests/Integration/AnnotatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
Domain\Payouts\Enums\Enum4::class,
]);

it('annotates enums overwriting existing annotations', function(string $enum) {
expect(fn() => (new Annotator($enum))->annotate(overwrite: true))->toAnnotate([$enum], true);
})->with([
App\Enums\Enum1::class,
App\Enums\Enum2::class,
Domain\Common\Enums\Enum3::class,
Domain\Payouts\Enums\Enum4::class,
]);
it('annotates enums overwriting existing annotations', function() {
$enum = Domain\Common\Enums\Enum3::class;

expect(fn() => (new Annotator($enum))->annotate(overwrite: true))
->toAnnotate([$enum], overwrite: true);
});
5 changes: 3 additions & 2 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@

foreach ($oldContents as $filename => $oldContent) {
$stub = __DIR__ . '/stubs/annotate/' . basename($filename, '.php') . '.stub';
$forceStub = __DIR__ . '/stubs/annotate/' . basename($filename, '.php') . '.force.stub';

if ($overwrite && file_exists($path = __DIR__ . '/stubs/' . basename($filename, '.php') . '.force.stub')) {
$stub = $path;
if ($overwrite && file_exists($forceStub)) {
$stub = $forceStub;
}

expect($filename)->toContainIgnoreEol($stub);
Expand Down
2 changes: 2 additions & 0 deletions tests/Skeleton/domain/Common/Enums/Enum3.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

/**
* The enum 3.
*
* @method static int count()
*/
#[Meta(next: null, isEven: false, alias: null)]
enum Enum3: string
Expand Down
1 change: 1 addition & 0 deletions tests/stubs/annotate/Enum3.stub
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use Cerbero\Enum\Concerns\Enumerates;
* @method static string One()
* @method static string Three()
* @method static string Two()
* @method static int count()
* @method ?string alias()
* @method float float()
* @method bool isEven()
Expand Down

0 comments on commit 16acb3b

Please sign in to comment.