@@ -12,89 +12,89 @@ |
||
| 12 | 12 | |
| 13 | 13 | class TraitAnnotationTest extends TestCase |
| 14 | 14 | { |
| 15 | - use AnnotationTrait; |
|
| 15 | +use AnnotationTrait; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * @var string |
| 19 | 19 | */ |
| 20 | - protected $sCacheDir; |
|
| 20 | +protected $sCacheDir; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @throws SetupException |
| 24 | 24 | */ |
| 25 | - public function setUp(): void |
|
| 26 | - { |
|
| 27 | - $this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 28 | - @mkdir($this->sCacheDir); |
|
| 25 | +public function setUp(): void |
|
| 26 | +{ |
|
| 27 | +$this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 28 | +@mkdir($this->sCacheDir); |
|
| 29 | 29 | |
| 30 | - jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 31 | - _register(); |
|
| 30 | +jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 31 | +_register(); |
|
| 32 | 32 | |
| 33 | - jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 34 | - } |
|
| 33 | +jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 34 | +} |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * @throws SetupException |
| 38 | 38 | */ |
| 39 | - public function tearDown(): void |
|
| 40 | - { |
|
| 41 | - jaxon()->reset(); |
|
| 42 | - parent::tearDown(); |
|
| 43 | - |
|
| 44 | - // Delete the temp dir and all its content |
|
| 45 | - $aFiles = scandir($this->sCacheDir); |
|
| 46 | - foreach ($aFiles as $sFile) |
|
| 47 | - { |
|
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 49 | - { |
|
| 50 | - @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - @rmdir($this->sCacheDir); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 39 | +public function tearDown(): void |
|
| 40 | +{ |
|
| 41 | +jaxon()->reset(); |
|
| 42 | +parent::tearDown(); |
|
| 43 | + |
|
| 44 | +// Delete the temp dir and all its content |
|
| 45 | +$aFiles = scandir($this->sCacheDir); |
|
| 46 | +foreach ($aFiles as $sFile) |
|
| 47 | +{ |
|
| 48 | +if($sFile !== '.' && $sFile !== '..') |
|
| 49 | +{ |
|
| 50 | + @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 51 | +} |
|
| 52 | +} |
|
| 53 | +@rmdir($this->sCacheDir); |
|
| 54 | +} |
|
| 55 | + |
|
| 56 | +/** |
|
| 57 | 57 | * @throws SetupException |
| 58 | 58 | */ |
| 59 | - public function testTraitAnnotation() |
|
| 60 | - { |
|
| 61 | - $xMetadata = $this->getAttributes(TraitAnnotated::class, []); |
|
| 62 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 63 | - $aProperties = $xMetadata->getProperties(); |
|
| 64 | - |
|
| 65 | - $this->assertFalse($bExcluded); |
|
| 66 | - |
|
| 67 | - $this->assertCount(1, $aProperties); |
|
| 68 | - $this->assertArrayHasKey('*', $aProperties); |
|
| 69 | - $this->assertCount(4, $aProperties['*']); |
|
| 70 | - $this->assertArrayHasKey('bags', $aProperties['*']); |
|
| 71 | - $this->assertArrayHasKey('__before', $aProperties['*']); |
|
| 72 | - $this->assertArrayHasKey('__after', $aProperties['*']); |
|
| 73 | - |
|
| 74 | - $this->assertCount(2, $aProperties['*']['bags']); |
|
| 75 | - $this->assertEquals('user.name', $aProperties['*']['bags'][0]); |
|
| 76 | - $this->assertEquals('page.number', $aProperties['*']['bags'][1]); |
|
| 77 | - |
|
| 78 | - $this->assertCount(2, $aProperties['*']['__before']); |
|
| 79 | - $this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']); |
|
| 80 | - $this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']); |
|
| 81 | - $this->assertIsArray($aProperties['*']['__before']['funcBefore1']); |
|
| 82 | - $this->assertIsArray($aProperties['*']['__before']['funcBefore2']); |
|
| 83 | - |
|
| 84 | - $this->assertCount(3, $aProperties['*']['__after']); |
|
| 85 | - $this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']); |
|
| 86 | - $this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']); |
|
| 87 | - $this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']); |
|
| 88 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter1']); |
|
| 89 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter2']); |
|
| 90 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter3']); |
|
| 91 | - |
|
| 92 | - $this->assertCount(3, $aProperties['*']['__di']); |
|
| 93 | - $this->assertArrayHasKey('colorService', $aProperties['*']['__di']); |
|
| 94 | - $this->assertArrayHasKey('textService', $aProperties['*']['__di']); |
|
| 95 | - $this->assertArrayHasKey('fontService', $aProperties['*']['__di']); |
|
| 96 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']); |
|
| 97 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']); |
|
| 98 | - $this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 99 | - } |
|
| 59 | +public function testTraitAnnotation() |
|
| 60 | +{ |
|
| 61 | +$xMetadata = $this->getAttributes(TraitAnnotated::class, []); |
|
| 62 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 63 | +$aProperties = $xMetadata->getProperties(); |
|
| 64 | + |
|
| 65 | +$this->assertFalse($bExcluded); |
|
| 66 | + |
|
| 67 | +$this->assertCount(1, $aProperties); |
|
| 68 | +$this->assertArrayHasKey('*', $aProperties); |
|
| 69 | +$this->assertCount(4, $aProperties['*']); |
|
| 70 | +$this->assertArrayHasKey('bags', $aProperties['*']); |
|
| 71 | +$this->assertArrayHasKey('__before', $aProperties['*']); |
|
| 72 | +$this->assertArrayHasKey('__after', $aProperties['*']); |
|
| 73 | + |
|
| 74 | +$this->assertCount(2, $aProperties['*']['bags']); |
|
| 75 | +$this->assertEquals('user.name', $aProperties['*']['bags'][0]); |
|
| 76 | +$this->assertEquals('page.number', $aProperties['*']['bags'][1]); |
|
| 77 | + |
|
| 78 | +$this->assertCount(2, $aProperties['*']['__before']); |
|
| 79 | +$this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']); |
|
| 80 | +$this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']); |
|
| 81 | +$this->assertIsArray($aProperties['*']['__before']['funcBefore1']); |
|
| 82 | +$this->assertIsArray($aProperties['*']['__before']['funcBefore2']); |
|
| 83 | + |
|
| 84 | +$this->assertCount(3, $aProperties['*']['__after']); |
|
| 85 | +$this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']); |
|
| 86 | +$this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']); |
|
| 87 | +$this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']); |
|
| 88 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter1']); |
|
| 89 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter2']); |
|
| 90 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter3']); |
|
| 91 | + |
|
| 92 | +$this->assertCount(3, $aProperties['*']['__di']); |
|
| 93 | +$this->assertArrayHasKey('colorService', $aProperties['*']['__di']); |
|
| 94 | +$this->assertArrayHasKey('textService', $aProperties['*']['__di']); |
|
| 95 | +$this->assertArrayHasKey('fontService', $aProperties['*']['__di']); |
|
| 96 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']); |
|
| 97 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']); |
|
| 98 | +$this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 99 | +} |
|
| 100 | 100 | } |
@@ -12,186 +12,186 @@ |
||
| 12 | 12 | |
| 13 | 13 | class AttrAnnotationTest extends TestCase |
| 14 | 14 | { |
| 15 | - use AnnotationTrait; |
|
| 15 | +use AnnotationTrait; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * @var string |
| 19 | 19 | */ |
| 20 | - protected $sCacheDir; |
|
| 20 | +protected $sCacheDir; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @throws SetupException |
| 24 | 24 | */ |
| 25 | - public function setUp(): void |
|
| 26 | - { |
|
| 27 | - $this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 28 | - @mkdir($this->sCacheDir); |
|
| 25 | +public function setUp(): void |
|
| 26 | +{ |
|
| 27 | +$this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 28 | +@mkdir($this->sCacheDir); |
|
| 29 | 29 | |
| 30 | - jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 31 | - _register(); |
|
| 30 | +jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 31 | +_register(); |
|
| 32 | 32 | |
| 33 | - jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 34 | - } |
|
| 33 | +jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 34 | +} |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * @throws SetupException |
| 38 | 38 | */ |
| 39 | - public function tearDown(): void |
|
| 40 | - { |
|
| 41 | - jaxon()->reset(); |
|
| 42 | - parent::tearDown(); |
|
| 43 | - |
|
| 44 | - // Delete the temp dir and all its content |
|
| 45 | - $aFiles = scandir($this->sCacheDir); |
|
| 46 | - foreach ($aFiles as $sFile) |
|
| 47 | - { |
|
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 49 | - { |
|
| 50 | - @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - @rmdir($this->sCacheDir); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - /** |
|
| 39 | +public function tearDown(): void |
|
| 40 | +{ |
|
| 41 | +jaxon()->reset(); |
|
| 42 | +parent::tearDown(); |
|
| 43 | + |
|
| 44 | +// Delete the temp dir and all its content |
|
| 45 | +$aFiles = scandir($this->sCacheDir); |
|
| 46 | +foreach ($aFiles as $sFile) |
|
| 47 | +{ |
|
| 48 | +if($sFile !== '.' && $sFile !== '..') |
|
| 49 | +{ |
|
| 50 | + @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 51 | +} |
|
| 52 | +} |
|
| 53 | +@rmdir($this->sCacheDir); |
|
| 54 | +} |
|
| 55 | + |
|
| 56 | +/** |
|
| 57 | 57 | * @throws SetupException |
| 58 | 58 | */ |
| 59 | - public function testContainerAnnotation() |
|
| 60 | - { |
|
| 61 | - $xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 62 | - ['attrVar'], ['colorService', 'fontService', 'textService']); |
|
| 63 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 64 | - $aProperties = $xMetadata->getProperties(); |
|
| 65 | - |
|
| 66 | - $this->assertFalse($bExcluded); |
|
| 67 | - |
|
| 68 | - $this->assertCount(1, $aProperties); |
|
| 69 | - $this->assertArrayHasKey('attrVar', $aProperties); |
|
| 70 | - $this->assertCount(3, $aProperties['attrVar']['__di']); |
|
| 71 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['attrVar']['__di']['colorService']); |
|
| 72 | - $this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['attrVar']['__di']['fontService']); |
|
| 73 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['attrVar']['__di']['textService']); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - /** |
|
| 59 | +public function testContainerAnnotation() |
|
| 60 | +{ |
|
| 61 | +$xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 62 | +['attrVar'], ['colorService', 'fontService', 'textService']); |
|
| 63 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 64 | +$aProperties = $xMetadata->getProperties(); |
|
| 65 | + |
|
| 66 | +$this->assertFalse($bExcluded); |
|
| 67 | + |
|
| 68 | +$this->assertCount(1, $aProperties); |
|
| 69 | +$this->assertArrayHasKey('attrVar', $aProperties); |
|
| 70 | +$this->assertCount(3, $aProperties['attrVar']['__di']); |
|
| 71 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['attrVar']['__di']['colorService']); |
|
| 72 | +$this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['attrVar']['__di']['fontService']); |
|
| 73 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['attrVar']['__di']['textService']); |
|
| 74 | +} |
|
| 75 | + |
|
| 76 | +/** |
|
| 77 | 77 | * @throws SetupException |
| 78 | 78 | */ |
| 79 | - public function testContainerDocBlockAnnotation() |
|
| 80 | - { |
|
| 81 | - $xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 82 | - ['attrDbVar'], ['colorService', 'fontService', 'textService']); |
|
| 83 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 84 | - $aProperties = $xMetadata->getProperties(); |
|
| 85 | - |
|
| 86 | - $this->assertFalse($bExcluded); |
|
| 87 | - |
|
| 88 | - $this->assertCount(1, $aProperties); |
|
| 89 | - $this->assertArrayHasKey('attrDbVar', $aProperties); |
|
| 90 | - $this->assertCount(3, $aProperties['attrDbVar']['__di']); |
|
| 91 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['attrDbVar']['__di']['colorService']); |
|
| 92 | - $this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['attrDbVar']['__di']['fontService']); |
|
| 93 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['attrDbVar']['__di']['textService']); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 79 | +public function testContainerDocBlockAnnotation() |
|
| 80 | +{ |
|
| 81 | +$xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 82 | +['attrDbVar'], ['colorService', 'fontService', 'textService']); |
|
| 83 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 84 | +$aProperties = $xMetadata->getProperties(); |
|
| 85 | + |
|
| 86 | +$this->assertFalse($bExcluded); |
|
| 87 | + |
|
| 88 | +$this->assertCount(1, $aProperties); |
|
| 89 | +$this->assertArrayHasKey('attrDbVar', $aProperties); |
|
| 90 | +$this->assertCount(3, $aProperties['attrDbVar']['__di']); |
|
| 91 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['attrDbVar']['__di']['colorService']); |
|
| 92 | +$this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['attrDbVar']['__di']['fontService']); |
|
| 93 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['attrDbVar']['__di']['textService']); |
|
| 94 | +} |
|
| 95 | + |
|
| 96 | +/** |
|
| 97 | 97 | * @throws SetupException |
| 98 | 98 | */ |
| 99 | - public function testContainerDiAnnotation() |
|
| 100 | - { |
|
| 101 | - $xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 102 | - ['attrDi'], ['colorService1', 'fontService1', 'textService1']); |
|
| 103 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 104 | - $aProperties = $xMetadata->getProperties(); |
|
| 105 | - |
|
| 106 | - $this->assertFalse($bExcluded); |
|
| 107 | - |
|
| 108 | - $this->assertCount(1, $aProperties); |
|
| 109 | - $this->assertArrayHasKey('*', $aProperties); |
|
| 110 | - $this->assertCount(3, $aProperties['*']['__di']); |
|
| 111 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService1']); |
|
| 112 | - $this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService1']); |
|
| 113 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService1']); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 99 | +public function testContainerDiAnnotation() |
|
| 100 | +{ |
|
| 101 | +$xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 102 | +['attrDi'], ['colorService1', 'fontService1', 'textService1']); |
|
| 103 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 104 | +$aProperties = $xMetadata->getProperties(); |
|
| 105 | + |
|
| 106 | +$this->assertFalse($bExcluded); |
|
| 107 | + |
|
| 108 | +$this->assertCount(1, $aProperties); |
|
| 109 | +$this->assertArrayHasKey('*', $aProperties); |
|
| 110 | +$this->assertCount(3, $aProperties['*']['__di']); |
|
| 111 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService1']); |
|
| 112 | +$this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService1']); |
|
| 113 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService1']); |
|
| 114 | +} |
|
| 115 | + |
|
| 116 | +/** |
|
| 117 | 117 | * @throws SetupException |
| 118 | 118 | */ |
| 119 | - public function testContainerDiAndVarAnnotation() |
|
| 120 | - { |
|
| 121 | - $xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 122 | - ['attrDi'], ['colorService2', 'fontService2', 'textService2']); |
|
| 123 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 124 | - $aProperties = $xMetadata->getProperties(); |
|
| 125 | - |
|
| 126 | - $this->assertFalse($bExcluded); |
|
| 127 | - |
|
| 128 | - $this->assertCount(1, $aProperties); |
|
| 129 | - $this->assertArrayHasKey('*', $aProperties); |
|
| 130 | - $this->assertCount(3, $aProperties['*']['__di']); |
|
| 131 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService2']); |
|
| 132 | - $this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService2']); |
|
| 133 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService2']); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 119 | +public function testContainerDiAndVarAnnotation() |
|
| 120 | +{ |
|
| 121 | +$xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 122 | +['attrDi'], ['colorService2', 'fontService2', 'textService2']); |
|
| 123 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 124 | +$aProperties = $xMetadata->getProperties(); |
|
| 125 | + |
|
| 126 | +$this->assertFalse($bExcluded); |
|
| 127 | + |
|
| 128 | +$this->assertCount(1, $aProperties); |
|
| 129 | +$this->assertArrayHasKey('*', $aProperties); |
|
| 130 | +$this->assertCount(3, $aProperties['*']['__di']); |
|
| 131 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService2']); |
|
| 132 | +$this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService2']); |
|
| 133 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService2']); |
|
| 134 | +} |
|
| 135 | + |
|
| 136 | +/** |
|
| 137 | 137 | * @throws SetupException |
| 138 | 138 | */ |
| 139 | - public function testContainerPropAnnotation() |
|
| 140 | - { |
|
| 141 | - $xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 142 | - ['attrDi'], ['colorService3', 'fontService3', 'textService3']); |
|
| 143 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 144 | - $aProperties = $xMetadata->getProperties(); |
|
| 145 | - |
|
| 146 | - $this->assertFalse($bExcluded); |
|
| 147 | - |
|
| 148 | - $this->assertCount(1, $aProperties); |
|
| 149 | - $this->assertArrayHasKey('*', $aProperties); |
|
| 150 | - $this->assertCount(3, $aProperties['*']['__di']); |
|
| 151 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService3']); |
|
| 152 | - $this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService3']); |
|
| 153 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService3']); |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - public function testContainerAnnotationErrorTwoParams() |
|
| 157 | - { |
|
| 158 | - $this->expectException(SetupException::class); |
|
| 159 | - $this->getAttributes(AttrAnnotated::class, [], ['errorTwoParams']); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - public function testContainerAnnotationErrorDiAttr() |
|
| 163 | - { |
|
| 164 | - $this->expectException(SetupException::class); |
|
| 165 | - $this->getAttributes(AttrAnnotated::class, [], ['errorDiAttr']); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - public function testContainerAnnotationErrorDiDbAttr() |
|
| 169 | - { |
|
| 170 | - $this->expectException(SetupException::class); |
|
| 171 | - $this->getAttributes(AttrAnnotated::class, [], ['errorDiDbAttr']); |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - public function testContainerAnnotationErrorTwoDi() |
|
| 175 | - { |
|
| 176 | - $this->expectException(SetupException::class); |
|
| 177 | - $this->getAttributes(AttrAnnotated::class, [], ['errorTwoDi']); |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - public function testContainerAnnotationErrorDiClass() |
|
| 181 | - { |
|
| 182 | - $this->expectException(SetupException::class); |
|
| 183 | - $this->getAttributes(AttrAnnotated::class, ['errorDiClass']); |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - public function testContainerAnnotationErrorNoVar() |
|
| 187 | - { |
|
| 188 | - $this->expectException(SetupException::class); |
|
| 189 | - $this->getAttributes(AttrAnnotated::class, ['errorDiNoVar']); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - public function testContainerAnnotationErrorTwoVars() |
|
| 193 | - { |
|
| 194 | - $this->expectException(SetupException::class); |
|
| 195 | - $this->getAttributes(AttrAnnotated::class, ['errorDiTwoVars']); |
|
| 196 | - } |
|
| 139 | +public function testContainerPropAnnotation() |
|
| 140 | +{ |
|
| 141 | +$xMetadata = $this->getAttributes(AttrAnnotated::class, |
|
| 142 | +['attrDi'], ['colorService3', 'fontService3', 'textService3']); |
|
| 143 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 144 | +$aProperties = $xMetadata->getProperties(); |
|
| 145 | + |
|
| 146 | +$this->assertFalse($bExcluded); |
|
| 147 | + |
|
| 148 | +$this->assertCount(1, $aProperties); |
|
| 149 | +$this->assertArrayHasKey('*', $aProperties); |
|
| 150 | +$this->assertCount(3, $aProperties['*']['__di']); |
|
| 151 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService3']); |
|
| 152 | +$this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService3']); |
|
| 153 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService3']); |
|
| 154 | +} |
|
| 155 | + |
|
| 156 | +public function testContainerAnnotationErrorTwoParams() |
|
| 157 | +{ |
|
| 158 | +$this->expectException(SetupException::class); |
|
| 159 | +$this->getAttributes(AttrAnnotated::class, [], ['errorTwoParams']); |
|
| 160 | +} |
|
| 161 | + |
|
| 162 | +public function testContainerAnnotationErrorDiAttr() |
|
| 163 | +{ |
|
| 164 | +$this->expectException(SetupException::class); |
|
| 165 | +$this->getAttributes(AttrAnnotated::class, [], ['errorDiAttr']); |
|
| 166 | +} |
|
| 167 | + |
|
| 168 | +public function testContainerAnnotationErrorDiDbAttr() |
|
| 169 | +{ |
|
| 170 | +$this->expectException(SetupException::class); |
|
| 171 | +$this->getAttributes(AttrAnnotated::class, [], ['errorDiDbAttr']); |
|
| 172 | +} |
|
| 173 | + |
|
| 174 | +public function testContainerAnnotationErrorTwoDi() |
|
| 175 | +{ |
|
| 176 | +$this->expectException(SetupException::class); |
|
| 177 | +$this->getAttributes(AttrAnnotated::class, [], ['errorTwoDi']); |
|
| 178 | +} |
|
| 179 | + |
|
| 180 | +public function testContainerAnnotationErrorDiClass() |
|
| 181 | +{ |
|
| 182 | +$this->expectException(SetupException::class); |
|
| 183 | +$this->getAttributes(AttrAnnotated::class, ['errorDiClass']); |
|
| 184 | +} |
|
| 185 | + |
|
| 186 | +public function testContainerAnnotationErrorNoVar() |
|
| 187 | +{ |
|
| 188 | +$this->expectException(SetupException::class); |
|
| 189 | +$this->getAttributes(AttrAnnotated::class, ['errorDiNoVar']); |
|
| 190 | +} |
|
| 191 | + |
|
| 192 | +public function testContainerAnnotationErrorTwoVars() |
|
| 193 | +{ |
|
| 194 | +$this->expectException(SetupException::class); |
|
| 195 | +$this->getAttributes(AttrAnnotated::class, ['errorDiTwoVars']); |
|
| 196 | +} |
|
| 197 | 197 | } |
@@ -6,18 +6,18 @@ |
||
| 6 | 6 | |
| 7 | 7 | trait Annotated |
| 8 | 8 | { |
| 9 | - /** |
|
| 9 | +/** |
|
| 10 | 10 | * @var \Jaxon\Annotations\Tests\Service\ColorService |
| 11 | 11 | */ |
| 12 | - protected $colorService; |
|
| 12 | +protected $colorService; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * @var TextService |
| 16 | 16 | */ |
| 17 | - protected $textService; |
|
| 17 | +protected $textService; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @var FontService |
| 21 | 21 | */ |
| 22 | - protected $fontService; |
|
| 22 | +protected $fontService; |
|
| 23 | 23 | } |
@@ -21,18 +21,18 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class ClassAnnotated extends FuncComponent |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @var \Jaxon\Annotations\Tests\Service\ColorService |
| 26 | 26 | */ |
| 27 | - protected $colorService; |
|
| 27 | +protected $colorService; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * @var TextService |
| 31 | 31 | */ |
| 32 | - protected $textService; |
|
| 32 | +protected $textService; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @var FontService |
| 36 | 36 | */ |
| 37 | - protected $fontService; |
|
| 37 | +protected $fontService; |
|
| 38 | 38 | } |
@@ -9,26 +9,26 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class DocBlockClassExcluded extends FuncComponent |
| 11 | 11 | { |
| 12 | - /** |
|
| 12 | +/** |
|
| 13 | 13 | * @exclude |
| 14 | 14 | */ |
| 15 | - public function doNot() |
|
| 16 | - { |
|
| 17 | - } |
|
| 15 | +public function doNot() |
|
| 16 | +{ |
|
| 17 | +} |
|
| 18 | 18 | |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @databag user.name |
| 21 | 21 | * @databag page.number |
| 22 | 22 | */ |
| 23 | - public function withBags() |
|
| 24 | - { |
|
| 25 | - } |
|
| 23 | +public function withBags() |
|
| 24 | +{ |
|
| 25 | +} |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * @before funcBefore |
| 29 | 29 | * @after funcAfter |
| 30 | 30 | */ |
| 31 | - public function cbSingle() |
|
| 32 | - { |
|
| 33 | - } |
|
| 31 | +public function cbSingle() |
|
| 32 | +{ |
|
| 33 | +} |
|
| 34 | 34 | } |
@@ -6,38 +6,38 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CallbackError extends FuncComponent |
| 8 | 8 | {
|
| 9 | - /** |
|
| 9 | +/** |
|
| 10 | 10 | * @callback |
| 11 | 11 | */ |
| 12 | - public function noName() |
|
| 13 | - {
|
|
| 14 | - } |
|
| 12 | +public function noName() |
|
| 13 | +{
|
|
| 14 | +} |
|
| 15 | 15 | |
| 16 | - /** |
|
| 16 | +/** |
|
| 17 | 17 | * @callback('name' => [])
|
| 18 | 18 | */ |
| 19 | - public function wrongNameType() |
|
| 20 | - {
|
|
| 21 | - } |
|
| 19 | +public function wrongNameType() |
|
| 20 | +{
|
|
| 21 | +} |
|
| 22 | 22 | |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * @callback('class' => 'jaxon.ajax.callback.test')
|
| 25 | 25 | */ |
| 26 | - public function wrongNameAttr() |
|
| 27 | - {
|
|
| 28 | - } |
|
| 26 | +public function wrongNameAttr() |
|
| 27 | +{
|
|
| 28 | +} |
|
| 29 | 29 | |
| 30 | - /** |
|
| 30 | +/** |
|
| 31 | 31 | * @callback('name' => 'jaxon.ajax callback.test')
|
| 32 | 32 | */ |
| 33 | - public function nameWithSpace() |
|
| 34 | - {
|
|
| 35 | - } |
|
| 33 | +public function nameWithSpace() |
|
| 34 | +{
|
|
| 35 | +} |
|
| 36 | 36 | |
| 37 | - /** |
|
| 37 | +/** |
|
| 38 | 38 | * @callback('class' => '12jaxon.ajax.callback.test')
|
| 39 | 39 | */ |
| 40 | - public function startWithInt() |
|
| 41 | - {
|
|
| 42 | - } |
|
| 40 | +public function startWithInt() |
|
| 41 | +{
|
|
| 42 | +} |
|
| 43 | 43 | } |
@@ -9,26 +9,26 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class ClassExcluded extends FuncComponent |
| 11 | 11 | { |
| 12 | - /** |
|
| 12 | +/** |
|
| 13 | 13 | * @exclude |
| 14 | 14 | */ |
| 15 | - public function doNot() |
|
| 16 | - { |
|
| 17 | - } |
|
| 15 | +public function doNot() |
|
| 16 | +{ |
|
| 17 | +} |
|
| 18 | 18 | |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @databag('name' => 'user.name') |
| 21 | 21 | * @databag('name' => 'page.number') |
| 22 | 22 | */ |
| 23 | - public function withBags() |
|
| 24 | - { |
|
| 25 | - } |
|
| 23 | +public function withBags() |
|
| 24 | +{ |
|
| 25 | +} |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * @before('call' => 'funcBefore') |
| 29 | 29 | * @after('call' => 'funcAfter') |
| 30 | 30 | */ |
| 31 | - public function cbSingle() |
|
| 32 | - { |
|
| 33 | - } |
|
| 31 | +public function cbSingle() |
|
| 32 | +{ |
|
| 33 | +} |
|
| 34 | 34 | } |
@@ -7,176 +7,176 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Annotated extends FuncComponent |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * @exclude |
| 12 | 12 | */ |
| 13 | - public function doNot() |
|
| 14 | - { |
|
| 15 | - } |
|
| 13 | +public function doNot() |
|
| 14 | +{ |
|
| 15 | +} |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * @exclude(true) |
| 19 | 19 | */ |
| 20 | - public function doNotBool() |
|
| 21 | - { |
|
| 22 | - } |
|
| 20 | +public function doNotBool() |
|
| 21 | +{ |
|
| 22 | +} |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @exclude('Me') |
| 26 | 26 | */ |
| 27 | - public function doNotError() |
|
| 28 | - { |
|
| 29 | - } |
|
| 27 | +public function doNotError() |
|
| 28 | +{ |
|
| 29 | +} |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * @databag('name' => 'user.name') |
| 33 | 33 | * @databag('name' => 'page.number') |
| 34 | 34 | */ |
| 35 | - public function withBags() |
|
| 36 | - { |
|
| 37 | - } |
|
| 35 | +public function withBags() |
|
| 36 | +{ |
|
| 37 | +} |
|
| 38 | 38 | |
| 39 | - /** |
|
| 39 | +/** |
|
| 40 | 40 | * @databag('mane' => 'user.name') |
| 41 | 41 | * @databag('mane' => 'page.number') |
| 42 | 42 | */ |
| 43 | - public function withBagsError() |
|
| 44 | - { |
|
| 45 | - } |
|
| 43 | +public function withBagsError() |
|
| 44 | +{ |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * @upload('field' => 'user-files') |
| 49 | 49 | */ |
| 50 | - public function saveFiles() |
|
| 51 | - { |
|
| 52 | - } |
|
| 50 | +public function saveFiles() |
|
| 51 | +{ |
|
| 52 | +} |
|
| 53 | 53 | |
| 54 | - /** |
|
| 54 | +/** |
|
| 55 | 55 | * @upload('name' => 'user-files') |
| 56 | 56 | */ |
| 57 | - public function saveFilesWrongName() |
|
| 58 | - { |
|
| 59 | - } |
|
| 57 | +public function saveFilesWrongName() |
|
| 58 | +{ |
|
| 59 | +} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * @upload('field' => 'user-file1') |
| 63 | 63 | * @upload('field' => 'user-file2') |
| 64 | 64 | */ |
| 65 | - public function saveFilesMultiple() |
|
| 66 | - { |
|
| 67 | - } |
|
| 65 | +public function saveFilesMultiple() |
|
| 66 | +{ |
|
| 67 | +} |
|
| 68 | 68 | |
| 69 | - /** |
|
| 69 | +/** |
|
| 70 | 70 | * @before('call' => 'funcBefore') |
| 71 | 71 | * @after('call' => 'funcAfter') |
| 72 | 72 | */ |
| 73 | - public function cbSingle() |
|
| 74 | - { |
|
| 75 | - } |
|
| 73 | +public function cbSingle() |
|
| 74 | +{ |
|
| 75 | +} |
|
| 76 | 76 | |
| 77 | - /** |
|
| 77 | +/** |
|
| 78 | 78 | * @before('call' => 'funcBefore1') |
| 79 | 79 | * @before('call' => 'funcBefore2') |
| 80 | 80 | * @after('call' => 'funcAfter1') |
| 81 | 81 | * @after('call' => 'funcAfter2') |
| 82 | 82 | * @after('call' => 'funcAfter3') |
| 83 | 83 | */ |
| 84 | - public function cbMultiple() |
|
| 85 | - { |
|
| 86 | - } |
|
| 84 | +public function cbMultiple() |
|
| 85 | +{ |
|
| 86 | +} |
|
| 87 | 87 | |
| 88 | - /** |
|
| 88 | +/** |
|
| 89 | 89 | * @before('call' => 'funcBefore1', 'with' => ['param1']) |
| 90 | 90 | * @before('call' => 'funcBefore2', 'with' => ['param1', 'param2']) |
| 91 | 91 | * @after('call' => 'funcAfter1', 'with' => ['param1', 'param2']) |
| 92 | 92 | */ |
| 93 | - public function cbParams() |
|
| 94 | - { |
|
| 95 | - } |
|
| 93 | +public function cbParams() |
|
| 94 | +{ |
|
| 95 | +} |
|
| 96 | 96 | |
| 97 | - /** |
|
| 97 | +/** |
|
| 98 | 98 | * @di('attr' => 'colorService', 'class' => 'ColorService') |
| 99 | 99 | * @di('attr' => 'fontService', 'class' => 'FontService') |
| 100 | 100 | */ |
| 101 | - public function di1() |
|
| 102 | - { |
|
| 103 | - } |
|
| 101 | +public function di1() |
|
| 102 | +{ |
|
| 103 | +} |
|
| 104 | 104 | |
| 105 | - /** |
|
| 105 | +/** |
|
| 106 | 106 | * @di('attr' => 'colorService', 'class' => 'ColorService') |
| 107 | 107 | * @di('attr' => 'textService', 'class' => '\Jaxon\Annotations\Tests\Service\TextService') |
| 108 | 108 | */ |
| 109 | - public function di2() |
|
| 110 | - { |
|
| 111 | - } |
|
| 109 | +public function di2() |
|
| 110 | +{ |
|
| 111 | +} |
|
| 112 | 112 | |
| 113 | - /** |
|
| 113 | +/** |
|
| 114 | 114 | * @before('name' => 'funcBefore', 'with' => ['param1']) |
| 115 | 115 | */ |
| 116 | - public function cbBeforeNoCall() |
|
| 117 | - { |
|
| 118 | - } |
|
| 116 | +public function cbBeforeNoCall() |
|
| 117 | +{ |
|
| 118 | +} |
|
| 119 | 119 | |
| 120 | - /** |
|
| 120 | +/** |
|
| 121 | 121 | * @before('call' => 'funcBefore', 'params' => ['param1']) |
| 122 | 122 | */ |
| 123 | - public function cbBeforeUnknownAttr() |
|
| 124 | - { |
|
| 125 | - } |
|
| 123 | +public function cbBeforeUnknownAttr() |
|
| 124 | +{ |
|
| 125 | +} |
|
| 126 | 126 | |
| 127 | - /** |
|
| 127 | +/** |
|
| 128 | 128 | * @before('call' => 'funcBefore', 'with' => 'param1') |
| 129 | 129 | */ |
| 130 | - public function cbBeforeWrongAttrType() |
|
| 131 | - { |
|
| 132 | - } |
|
| 130 | +public function cbBeforeWrongAttrType() |
|
| 131 | +{ |
|
| 132 | +} |
|
| 133 | 133 | |
| 134 | - /** |
|
| 134 | +/** |
|
| 135 | 135 | * @after('name' => 'funcAfter', 'with' => ['param1']) |
| 136 | 136 | */ |
| 137 | - public function cbAfterNoCall() |
|
| 138 | - { |
|
| 139 | - } |
|
| 137 | +public function cbAfterNoCall() |
|
| 138 | +{ |
|
| 139 | +} |
|
| 140 | 140 | |
| 141 | - /** |
|
| 141 | +/** |
|
| 142 | 142 | * @after('call' => 'funcAfter', 'params' => ['param1']) |
| 143 | 143 | */ |
| 144 | - public function cbAfterUnknownAttr() |
|
| 145 | - { |
|
| 146 | - } |
|
| 144 | +public function cbAfterUnknownAttr() |
|
| 145 | +{ |
|
| 146 | +} |
|
| 147 | 147 | |
| 148 | - /** |
|
| 148 | +/** |
|
| 149 | 149 | * @after('call' => 'funcAfter', 'with' => true) |
| 150 | 150 | */ |
| 151 | - public function cbAfterWrongAttrType() |
|
| 152 | - { |
|
| 153 | - } |
|
| 151 | +public function cbAfterWrongAttrType() |
|
| 152 | +{ |
|
| 153 | +} |
|
| 154 | 154 | |
| 155 | - /** |
|
| 155 | +/** |
|
| 156 | 156 | * @di('attr' => 'attr', 'params' => '') |
| 157 | 157 | */ |
| 158 | - public function diUnknownAttr() |
|
| 159 | - { |
|
| 160 | - } |
|
| 158 | +public function diUnknownAttr() |
|
| 159 | +{ |
|
| 160 | +} |
|
| 161 | 161 | |
| 162 | - /** |
|
| 162 | +/** |
|
| 163 | 163 | * @di('attr' => [], 'class' => 'ClassName') |
| 164 | 164 | */ |
| 165 | - public function diWrongAttrType() |
|
| 166 | - { |
|
| 167 | - } |
|
| 165 | +public function diWrongAttrType() |
|
| 166 | +{ |
|
| 167 | +} |
|
| 168 | 168 | |
| 169 | - /** |
|
| 169 | +/** |
|
| 170 | 170 | * @di('attr' => 'attr', 'class' => true) |
| 171 | 171 | */ |
| 172 | - public function diWrongClassType() |
|
| 173 | - { |
|
| 174 | - } |
|
| 172 | +public function diWrongClassType() |
|
| 173 | +{ |
|
| 174 | +} |
|
| 175 | 175 | |
| 176 | - /** |
|
| 176 | +/** |
|
| 177 | 177 | * @di('attr' => 'attr', 'class' => 'ClassName', 'name' => 'di') |
| 178 | 178 | */ |
| 179 | - public function diWrongVarCount() |
|
| 180 | - { |
|
| 181 | - } |
|
| 179 | +public function diWrongVarCount() |
|
| 180 | +{ |
|
| 181 | +} |
|
| 182 | 182 | } |
@@ -20,5 +20,5 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class TraitAnnotated extends FuncComponent |
| 22 | 22 | { |
| 23 | - use Traits\Annotated; |
|
| 23 | +use Traits\Annotated; |
|
| 24 | 24 | } |