|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | +/** |
| 5 | + * This file is part of Hyperf. |
| 6 | + * |
| 7 | + * @link https://www.hyperf.io |
| 8 | + * @document https://hyperf.wiki |
| 9 | + |
| 10 | + * @license https://github.com/hyperf/hyperf/blob/master/LICENSE |
| 11 | + */ |
| 12 | +namespace HyperfTest\Di\Annotation; |
| 13 | + |
| 14 | +use Hyperf\Di\Annotation\AspectLoader; |
| 15 | +use Hyperf\Di\Annotation\Inject; |
| 16 | +use HyperfTest\Di\Stub\Aspect\Debug1Aspect; |
| 17 | +use HyperfTest\Di\Stub\Aspect\DebugLoaderAspect; |
| 18 | +use PHPUnit\Framework\TestCase; |
| 19 | + |
| 20 | +/** |
| 21 | + * @internal |
| 22 | + * @coversNothing |
| 23 | + */ |
| 24 | +class AspectLoaderTest extends TestCase |
| 25 | +{ |
| 26 | + public function testLoad() |
| 27 | + { |
| 28 | + [$classes, $annotations, $priority] = AspectLoader::load(Debug1Aspect::class); |
| 29 | + |
| 30 | + $this->assertSame(['Debug1AspectFoo'], $classes); |
| 31 | + $this->assertSame([], $annotations); |
| 32 | + $this->assertSame(null, $priority); |
| 33 | + |
| 34 | + [$classes, $annotations, $priority] = AspectLoader::load(DebugLoaderAspect::class); |
| 35 | + |
| 36 | + $this->assertSame(['Debug1AspectFoo'], $classes); |
| 37 | + $this->assertSame([Inject::class], $annotations); |
| 38 | + $this->assertSame(100, $priority); |
| 39 | + } |
| 40 | +} |
0 commit comments