Skip to content

Commit

Permalink
test:
Browse files Browse the repository at this point in the history
  • Loading branch information
apple-x-co committed May 19, 2024
1 parent e99a40a commit ede1515
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/AopCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testReturnType(): void
public function testVariousMethodSignature(): void
{
$bind = new Bind();
for ($i = 1; $i <= 23; $i++) {
for ($i = 1; $i <= 24; $i++) {
$bind->bindInterceptors('method' . (string) $i, []);
}

Expand Down Expand Up @@ -89,6 +89,8 @@ public function method21()', $code);
public function method22()', $code);
$this->assertStringContainsString('#[\\Ray\\Aop\\Annotation\\FakeMarker5(\\Ray\\Aop\\FakePhp81Enum::Apple)]
public function method23()', $code);
$this->assertStringContainsString('#[\\Ray\\Aop\\Annotation\\FakeMarker6(fruit1: \\Ray\\Aop\\FakePhp81Enum::Apple, fruit2: \\Ray\\Aop\\FakePhp81Enum::Orange)]
public function method24()', $code);
}

/** @requires PHP 8.2 */
Expand Down
22 changes: 22 additions & 0 deletions tests/Fake/Annotation/FakeMarker6.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace Ray\Aop\Annotation;

use Attribute;
use Ray\Aop\FakePhp81Enum;

/**
* @Annotation
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class FakeMarker6
{
public function __construct(
public readonly FakePhp81Enum $fruit1,
public readonly FakePhp81Enum $fruit2,
) {
}
}
4 changes: 4 additions & 0 deletions tests/Fake/FakePhp8Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Ray\Aop\Annotation\FakeMarker4;
use Ray\Aop\Annotation\FakeMarker5;
use Ray\Aop\Annotation\FakeMarker6;
use Ray\Aop\Annotation\FakeMarkerName;

class FakePhp8Types implements FakeNullInterface, \Ray\Aop\FakeNullInterface1
Expand Down Expand Up @@ -65,4 +66,7 @@ public function method22() {}

#[FakeMarker5(FakePhp81Enum::Apple)]
public function method23() {}

#[FakeMarker6(fruit1: FakePhp81Enum::Apple, fruit2: FakePhp81Enum::Orange)]
public function method24() {}
}

0 comments on commit ede1515

Please sign in to comment.