@@ -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\Attr\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\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 99 | +} |
|
| 100 | 100 | } |
@@ -14,346 +14,346 @@ |
||
| 14 | 14 | |
| 15 | 15 | class ExtendAnnotationTest extends TestCase |
| 16 | 16 | { |
| 17 | - use AnnotationTrait; |
|
| 17 | +use AnnotationTrait; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $sCacheDir; |
|
| 22 | +protected $sCacheDir; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @throws SetupException |
| 26 | 26 | */ |
| 27 | - public function setUp(): void |
|
| 28 | - { |
|
| 29 | - $this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 30 | - @mkdir($this->sCacheDir); |
|
| 27 | +public function setUp(): void |
|
| 28 | +{ |
|
| 29 | +$this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 30 | +@mkdir($this->sCacheDir); |
|
| 31 | 31 | |
| 32 | - jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 33 | - _register(); |
|
| 32 | +jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 33 | +_register(); |
|
| 34 | 34 | |
| 35 | - jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 36 | - } |
|
| 35 | +jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 36 | +} |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * @throws SetupException |
| 40 | 40 | */ |
| 41 | - public function tearDown(): void |
|
| 42 | - { |
|
| 43 | - jaxon()->reset(); |
|
| 44 | - parent::tearDown(); |
|
| 45 | - |
|
| 46 | - // Delete the temp dir and all its content |
|
| 47 | - $aFiles = scandir($this->sCacheDir); |
|
| 48 | - foreach ($aFiles as $sFile) |
|
| 49 | - { |
|
| 50 | - if($sFile !== '.' && $sFile !== '..') |
|
| 51 | - { |
|
| 52 | - @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - @rmdir($this->sCacheDir); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - /** |
|
| 41 | +public function tearDown(): void |
|
| 42 | +{ |
|
| 43 | +jaxon()->reset(); |
|
| 44 | +parent::tearDown(); |
|
| 45 | + |
|
| 46 | +// Delete the temp dir and all its content |
|
| 47 | +$aFiles = scandir($this->sCacheDir); |
|
| 48 | +foreach ($aFiles as $sFile) |
|
| 49 | +{ |
|
| 50 | +if($sFile !== '.' && $sFile !== '..') |
|
| 51 | +{ |
|
| 52 | + @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 53 | +} |
|
| 54 | +} |
|
| 55 | +@rmdir($this->sCacheDir); |
|
| 56 | +} |
|
| 57 | + |
|
| 58 | +/** |
|
| 59 | 59 | * @throws SetupException |
| 60 | 60 | */ |
| 61 | - public function testUploadAndExcludeAnnotation() |
|
| 62 | - { |
|
| 63 | - $xMetadata = $this->getAttributes(ExtendAnnotated::class, ['saveFiles', 'doNot']); |
|
| 64 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 65 | - $aProperties = $xMetadata->getProperties(); |
|
| 66 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 61 | +public function testUploadAndExcludeAnnotation() |
|
| 62 | +{ |
|
| 63 | +$xMetadata = $this->getAttributes(ExtendAnnotated::class, ['saveFiles', 'doNot']); |
|
| 64 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 65 | +$aProperties = $xMetadata->getProperties(); |
|
| 66 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 67 | 67 | |
| 68 | - $this->assertFalse($bExcluded); |
|
| 68 | +$this->assertFalse($bExcluded); |
|
| 69 | 69 | |
| 70 | - $this->assertCount(1, $aProperties); |
|
| 71 | - $this->assertArrayHasKey('saveFiles', $aProperties); |
|
| 72 | - $this->assertCount(1, $aProperties['saveFiles']); |
|
| 73 | - $this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']); |
|
| 70 | +$this->assertCount(1, $aProperties); |
|
| 71 | +$this->assertArrayHasKey('saveFiles', $aProperties); |
|
| 72 | +$this->assertCount(1, $aProperties['saveFiles']); |
|
| 73 | +$this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']); |
|
| 74 | 74 | |
| 75 | - $this->assertCount(1, $aExcluded); |
|
| 76 | - $this->assertEquals('doNot', $aExcluded[0]); |
|
| 77 | - } |
|
| 75 | +$this->assertCount(1, $aExcluded); |
|
| 76 | +$this->assertEquals('doNot', $aExcluded[0]); |
|
| 77 | +} |
|
| 78 | 78 | |
| 79 | - /** |
|
| 79 | +/** |
|
| 80 | 80 | * @throws SetupException |
| 81 | 81 | */ |
| 82 | - public function testDatabagAnnotation() |
|
| 83 | - { |
|
| 84 | - $xMetadata = $this->getAttributes(ExtendAnnotated::class, ['withBags']); |
|
| 85 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 86 | - $aProperties = $xMetadata->getProperties(); |
|
| 87 | - |
|
| 88 | - $this->assertFalse($bExcluded); |
|
| 89 | - |
|
| 90 | - $this->assertCount(1, $aProperties); |
|
| 91 | - $this->assertArrayHasKey('withBags', $aProperties); |
|
| 92 | - $this->assertCount(1, $aProperties['withBags']); |
|
| 93 | - $this->assertCount(2, $aProperties['withBags']['bags']); |
|
| 94 | - $this->assertEquals('user.name', $aProperties['withBags']['bags'][0]); |
|
| 95 | - $this->assertEquals('page.number', $aProperties['withBags']['bags'][1]); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - /** |
|
| 82 | +public function testDatabagAnnotation() |
|
| 83 | +{ |
|
| 84 | +$xMetadata = $this->getAttributes(ExtendAnnotated::class, ['withBags']); |
|
| 85 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 86 | +$aProperties = $xMetadata->getProperties(); |
|
| 87 | + |
|
| 88 | +$this->assertFalse($bExcluded); |
|
| 89 | + |
|
| 90 | +$this->assertCount(1, $aProperties); |
|
| 91 | +$this->assertArrayHasKey('withBags', $aProperties); |
|
| 92 | +$this->assertCount(1, $aProperties['withBags']); |
|
| 93 | +$this->assertCount(2, $aProperties['withBags']['bags']); |
|
| 94 | +$this->assertEquals('user.name', $aProperties['withBags']['bags'][0]); |
|
| 95 | +$this->assertEquals('page.number', $aProperties['withBags']['bags'][1]); |
|
| 96 | +} |
|
| 97 | + |
|
| 98 | +/** |
|
| 99 | 99 | * @throws SetupException |
| 100 | 100 | */ |
| 101 | - public function testServerCallbacksAnnotation() |
|
| 102 | - { |
|
| 103 | - $xMetadata = $this->getAttributes(ExtendAnnotated::class, |
|
| 104 | - ['cbSingle', 'cbMultiple', 'cbParams']); |
|
| 105 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 106 | - $aProperties = $xMetadata->getProperties(); |
|
| 107 | - |
|
| 108 | - $this->assertFalse($bExcluded); |
|
| 109 | - |
|
| 110 | - $this->assertCount(3, $aProperties); |
|
| 111 | - $this->assertArrayHasKey('cbSingle', $aProperties); |
|
| 112 | - $this->assertArrayHasKey('cbMultiple', $aProperties); |
|
| 113 | - $this->assertArrayHasKey('cbParams', $aProperties); |
|
| 114 | - |
|
| 115 | - $this->assertCount(1, $aProperties['cbSingle']['__before']); |
|
| 116 | - $this->assertCount(2, $aProperties['cbMultiple']['__before']); |
|
| 117 | - $this->assertCount(2, $aProperties['cbParams']['__before']); |
|
| 118 | - $this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']); |
|
| 119 | - $this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']); |
|
| 120 | - $this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']); |
|
| 121 | - $this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']); |
|
| 122 | - $this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']); |
|
| 123 | - $this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']); |
|
| 124 | - $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']); |
|
| 125 | - $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']); |
|
| 126 | - $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']); |
|
| 127 | - $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']); |
|
| 128 | - |
|
| 129 | - $this->assertCount(1, $aProperties['cbSingle']['__after']); |
|
| 130 | - $this->assertCount(3, $aProperties['cbMultiple']['__after']); |
|
| 131 | - $this->assertCount(1, $aProperties['cbParams']['__after']); |
|
| 132 | - $this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']); |
|
| 133 | - $this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']); |
|
| 134 | - $this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']); |
|
| 135 | - $this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']); |
|
| 136 | - $this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']); |
|
| 137 | - $this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']); |
|
| 138 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']); |
|
| 139 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']); |
|
| 140 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']); |
|
| 141 | - $this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']); |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 101 | +public function testServerCallbacksAnnotation() |
|
| 102 | +{ |
|
| 103 | +$xMetadata = $this->getAttributes(ExtendAnnotated::class, |
|
| 104 | +['cbSingle', 'cbMultiple', 'cbParams']); |
|
| 105 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 106 | +$aProperties = $xMetadata->getProperties(); |
|
| 107 | + |
|
| 108 | +$this->assertFalse($bExcluded); |
|
| 109 | + |
|
| 110 | +$this->assertCount(3, $aProperties); |
|
| 111 | +$this->assertArrayHasKey('cbSingle', $aProperties); |
|
| 112 | +$this->assertArrayHasKey('cbMultiple', $aProperties); |
|
| 113 | +$this->assertArrayHasKey('cbParams', $aProperties); |
|
| 114 | + |
|
| 115 | +$this->assertCount(1, $aProperties['cbSingle']['__before']); |
|
| 116 | +$this->assertCount(2, $aProperties['cbMultiple']['__before']); |
|
| 117 | +$this->assertCount(2, $aProperties['cbParams']['__before']); |
|
| 118 | +$this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']); |
|
| 119 | +$this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']); |
|
| 120 | +$this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']); |
|
| 121 | +$this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']); |
|
| 122 | +$this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']); |
|
| 123 | +$this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']); |
|
| 124 | +$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']); |
|
| 125 | +$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']); |
|
| 126 | +$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']); |
|
| 127 | +$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']); |
|
| 128 | + |
|
| 129 | +$this->assertCount(1, $aProperties['cbSingle']['__after']); |
|
| 130 | +$this->assertCount(3, $aProperties['cbMultiple']['__after']); |
|
| 131 | +$this->assertCount(1, $aProperties['cbParams']['__after']); |
|
| 132 | +$this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']); |
|
| 133 | +$this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']); |
|
| 134 | +$this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']); |
|
| 135 | +$this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']); |
|
| 136 | +$this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']); |
|
| 137 | +$this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']); |
|
| 138 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']); |
|
| 139 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']); |
|
| 140 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']); |
|
| 141 | +$this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']); |
|
| 142 | +} |
|
| 143 | + |
|
| 144 | +/** |
|
| 145 | 145 | * @throws SetupException |
| 146 | 146 | */ |
| 147 | - public function testContainerAnnotation() |
|
| 148 | - { |
|
| 149 | - $xMetadata = $this->getAttributes(ExtendAnnotated::class, ['di1', 'di2']); |
|
| 150 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 151 | - $aProperties = $xMetadata->getProperties(); |
|
| 152 | - |
|
| 153 | - $this->assertFalse($bExcluded); |
|
| 154 | - |
|
| 155 | - $this->assertCount(2, $aProperties); |
|
| 156 | - $this->assertArrayHasKey('di1', $aProperties); |
|
| 157 | - $this->assertArrayHasKey('di2', $aProperties); |
|
| 158 | - $this->assertCount(2, $aProperties['di1']['__di']); |
|
| 159 | - $this->assertCount(2, $aProperties['di2']['__di']); |
|
| 160 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']); |
|
| 161 | - $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']); |
|
| 162 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']); |
|
| 163 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - /** |
|
| 147 | +public function testContainerAnnotation() |
|
| 148 | +{ |
|
| 149 | +$xMetadata = $this->getAttributes(ExtendAnnotated::class, ['di1', 'di2']); |
|
| 150 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 151 | +$aProperties = $xMetadata->getProperties(); |
|
| 152 | + |
|
| 153 | +$this->assertFalse($bExcluded); |
|
| 154 | + |
|
| 155 | +$this->assertCount(2, $aProperties); |
|
| 156 | +$this->assertArrayHasKey('di1', $aProperties); |
|
| 157 | +$this->assertArrayHasKey('di2', $aProperties); |
|
| 158 | +$this->assertCount(2, $aProperties['di1']['__di']); |
|
| 159 | +$this->assertCount(2, $aProperties['di2']['__di']); |
|
| 160 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']); |
|
| 161 | +$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']); |
|
| 162 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']); |
|
| 163 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']); |
|
| 164 | +} |
|
| 165 | + |
|
| 166 | +/** |
|
| 167 | 167 | * @throws SetupException |
| 168 | 168 | */ |
| 169 | - public function testClassAnnotation() |
|
| 170 | - { |
|
| 171 | - $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 172 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 173 | - $aProperties = $xMetadata->getProperties(); |
|
| 174 | - |
|
| 175 | - $this->assertFalse($bExcluded); |
|
| 176 | - |
|
| 177 | - $this->assertCount(1, $aProperties); |
|
| 178 | - $this->assertArrayHasKey('*', $aProperties); |
|
| 179 | - $this->assertCount(5, $aProperties['*']); |
|
| 180 | - $this->assertArrayHasKey('bags', $aProperties['*']); |
|
| 181 | - $this->assertArrayHasKey('callback', $aProperties['*']); |
|
| 182 | - $this->assertArrayHasKey('__before', $aProperties['*']); |
|
| 183 | - $this->assertArrayHasKey('__after', $aProperties['*']); |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 169 | +public function testClassAnnotation() |
|
| 170 | +{ |
|
| 171 | +$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 172 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 173 | +$aProperties = $xMetadata->getProperties(); |
|
| 174 | + |
|
| 175 | +$this->assertFalse($bExcluded); |
|
| 176 | + |
|
| 177 | +$this->assertCount(1, $aProperties); |
|
| 178 | +$this->assertArrayHasKey('*', $aProperties); |
|
| 179 | +$this->assertCount(5, $aProperties['*']); |
|
| 180 | +$this->assertArrayHasKey('bags', $aProperties['*']); |
|
| 181 | +$this->assertArrayHasKey('callback', $aProperties['*']); |
|
| 182 | +$this->assertArrayHasKey('__before', $aProperties['*']); |
|
| 183 | +$this->assertArrayHasKey('__after', $aProperties['*']); |
|
| 184 | +} |
|
| 185 | + |
|
| 186 | +/** |
|
| 187 | 187 | * @throws SetupException |
| 188 | 188 | */ |
| 189 | - public function testClassBagsAnnotation() |
|
| 190 | - { |
|
| 191 | - $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 192 | - $aProperties = $xMetadata->getProperties(); |
|
| 189 | +public function testClassBagsAnnotation() |
|
| 190 | +{ |
|
| 191 | +$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 192 | +$aProperties = $xMetadata->getProperties(); |
|
| 193 | 193 | |
| 194 | - $this->assertCount(2, $aProperties['*']['bags']); |
|
| 195 | - $this->assertEquals('user.name', $aProperties['*']['bags'][0]); |
|
| 196 | - $this->assertEquals('page.number', $aProperties['*']['bags'][1]); |
|
| 197 | - } |
|
| 194 | +$this->assertCount(2, $aProperties['*']['bags']); |
|
| 195 | +$this->assertEquals('user.name', $aProperties['*']['bags'][0]); |
|
| 196 | +$this->assertEquals('page.number', $aProperties['*']['bags'][1]); |
|
| 197 | +} |
|
| 198 | 198 | |
| 199 | - /** |
|
| 199 | +/** |
|
| 200 | 200 | * @throws SetupException |
| 201 | 201 | */ |
| 202 | - public function testClassCallbackAnnotation() |
|
| 203 | - { |
|
| 204 | - $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 205 | - $aProperties = $xMetadata->getProperties(); |
|
| 202 | +public function testClassCallbackAnnotation() |
|
| 203 | +{ |
|
| 204 | +$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 205 | +$aProperties = $xMetadata->getProperties(); |
|
| 206 | 206 | |
| 207 | - $this->assertIsArray($aProperties['*']['callback']); |
|
| 208 | - $this->assertEquals('jaxon.callback.global', $aProperties['*']['callback'][0]); |
|
| 209 | - } |
|
| 207 | +$this->assertIsArray($aProperties['*']['callback']); |
|
| 208 | +$this->assertEquals('jaxon.callback.global', $aProperties['*']['callback'][0]); |
|
| 209 | +} |
|
| 210 | 210 | |
| 211 | - /** |
|
| 211 | +/** |
|
| 212 | 212 | * @throws SetupException |
| 213 | 213 | */ |
| 214 | - public function testClassBeforeAnnotation() |
|
| 215 | - { |
|
| 216 | - $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 217 | - $aProperties = $xMetadata->getProperties(); |
|
| 218 | - |
|
| 219 | - $this->assertCount(2, $aProperties['*']['__before']); |
|
| 220 | - $this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']); |
|
| 221 | - $this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']); |
|
| 222 | - $this->assertIsArray($aProperties['*']['__before']['funcBefore1']); |
|
| 223 | - $this->assertIsArray($aProperties['*']['__before']['funcBefore2']); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - /** |
|
| 214 | +public function testClassBeforeAnnotation() |
|
| 215 | +{ |
|
| 216 | +$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 217 | +$aProperties = $xMetadata->getProperties(); |
|
| 218 | + |
|
| 219 | +$this->assertCount(2, $aProperties['*']['__before']); |
|
| 220 | +$this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']); |
|
| 221 | +$this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']); |
|
| 222 | +$this->assertIsArray($aProperties['*']['__before']['funcBefore1']); |
|
| 223 | +$this->assertIsArray($aProperties['*']['__before']['funcBefore2']); |
|
| 224 | +} |
|
| 225 | + |
|
| 226 | +/** |
|
| 227 | 227 | * @throws SetupException |
| 228 | 228 | */ |
| 229 | - public function testClassAfterAnnotation() |
|
| 230 | - { |
|
| 231 | - $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 232 | - $aProperties = $xMetadata->getProperties(); |
|
| 233 | - |
|
| 234 | - $this->assertCount(3, $aProperties['*']['__after']); |
|
| 235 | - $this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']); |
|
| 236 | - $this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']); |
|
| 237 | - $this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']); |
|
| 238 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter1']); |
|
| 239 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter2']); |
|
| 240 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter3']); |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - /** |
|
| 229 | +public function testClassAfterAnnotation() |
|
| 230 | +{ |
|
| 231 | +$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 232 | +$aProperties = $xMetadata->getProperties(); |
|
| 233 | + |
|
| 234 | +$this->assertCount(3, $aProperties['*']['__after']); |
|
| 235 | +$this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']); |
|
| 236 | +$this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']); |
|
| 237 | +$this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']); |
|
| 238 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter1']); |
|
| 239 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter2']); |
|
| 240 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter3']); |
|
| 241 | +} |
|
| 242 | + |
|
| 243 | +/** |
|
| 244 | 244 | * @throws SetupException |
| 245 | 245 | */ |
| 246 | - public function testClassDiAnnotation() |
|
| 247 | - { |
|
| 248 | - $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 249 | - $aProperties = $xMetadata->getProperties(); |
|
| 250 | - |
|
| 251 | - $this->assertCount(3, $aProperties['*']['__di']); |
|
| 252 | - $this->assertArrayHasKey('colorService', $aProperties['*']['__di']); |
|
| 253 | - $this->assertArrayHasKey('textService', $aProperties['*']['__di']); |
|
| 254 | - $this->assertArrayHasKey('fontService', $aProperties['*']['__di']); |
|
| 255 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']); |
|
| 256 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']); |
|
| 257 | - $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - /** |
|
| 246 | +public function testClassDiAnnotation() |
|
| 247 | +{ |
|
| 248 | +$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []); |
|
| 249 | +$aProperties = $xMetadata->getProperties(); |
|
| 250 | + |
|
| 251 | +$this->assertCount(3, $aProperties['*']['__di']); |
|
| 252 | +$this->assertArrayHasKey('colorService', $aProperties['*']['__di']); |
|
| 253 | +$this->assertArrayHasKey('textService', $aProperties['*']['__di']); |
|
| 254 | +$this->assertArrayHasKey('fontService', $aProperties['*']['__di']); |
|
| 255 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']); |
|
| 256 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']); |
|
| 257 | +$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 258 | +} |
|
| 259 | + |
|
| 260 | +/** |
|
| 261 | 261 | * @throws SetupException |
| 262 | 262 | */ |
| 263 | - public function testClassExcludeAnnotation() |
|
| 264 | - { |
|
| 265 | - $xMetadata = $this->getAttributes(ClassExcluded::class, |
|
| 266 | - ['doNot', 'withBags', 'cbSingle']); |
|
| 267 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 268 | - $aProperties = $xMetadata->getProperties(); |
|
| 269 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 270 | - |
|
| 271 | - $this->assertTrue($bExcluded); |
|
| 272 | - $this->assertEmpty($aProperties); |
|
| 273 | - $this->assertEmpty($aExcluded); |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - public function testExcludeAnnotationError() |
|
| 277 | - { |
|
| 278 | - $this->expectException(SetupException::class); |
|
| 279 | - $this->getAttributes(ExtendAnnotated::class, ['doNotError']); |
|
| 280 | - } |
|
| 281 | - |
|
| 282 | - public function testDatabagAnnotationError() |
|
| 283 | - { |
|
| 284 | - $this->expectException(SetupException::class); |
|
| 285 | - $this->getAttributes(ExtendAnnotated::class, ['withBagsError']); |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - public function testUploadAnnotationWrongName() |
|
| 289 | - { |
|
| 290 | - $this->expectException(SetupException::class); |
|
| 291 | - $this->getAttributes(ExtendAnnotated::class, ['saveFilesWrongName']); |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - public function testUploadAnnotationMultiple() |
|
| 295 | - { |
|
| 296 | - $this->expectException(SetupException::class); |
|
| 297 | - $this->getAttributes(ExtendAnnotated::class, ['saveFilesMultiple']); |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - public function testCallbacksBeforeAnnotationNoCall() |
|
| 301 | - { |
|
| 302 | - $this->expectException(SetupException::class); |
|
| 303 | - $this->getAttributes(ExtendAnnotated::class, ['cbBeforeNoCall']); |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - public function testCallbacksBeforeAnnotationUnknownAttr() |
|
| 307 | - { |
|
| 308 | - $this->expectException(SetupException::class); |
|
| 309 | - $this->getAttributes(ExtendAnnotated::class, ['cbBeforeUnknownAttr']); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - public function testCallbacksBeforeAnnotationWrongAttrType() |
|
| 313 | - { |
|
| 314 | - $this->expectException(SetupException::class); |
|
| 315 | - $this->getAttributes(ExtendAnnotated::class, ['cbBeforeWrongAttrType']); |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - public function testCallbacksAfterAnnotationNoCall() |
|
| 319 | - { |
|
| 320 | - $this->expectException(SetupException::class); |
|
| 321 | - $this->getAttributes(ExtendAnnotated::class, ['cbAfterNoCall']); |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - public function testCallbacksAfterAnnotationUnknownAttr() |
|
| 325 | - { |
|
| 326 | - $this->expectException(SetupException::class); |
|
| 327 | - $this->getAttributes(ExtendAnnotated::class, ['cbAfterUnknownAttr']); |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - public function testCallbacksAfterAnnotationWrongAttrType() |
|
| 331 | - { |
|
| 332 | - $this->expectException(SetupException::class); |
|
| 333 | - $this->getAttributes(ExtendAnnotated::class, ['cbAfterWrongAttrType']); |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - public function testContainerAnnotationUnknownAttr() |
|
| 337 | - { |
|
| 338 | - $this->expectException(SetupException::class); |
|
| 339 | - $this->getAttributes(ExtendAnnotated::class, ['diUnknownAttr']); |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - public function testContainerAnnotationWrongAttrType() |
|
| 343 | - { |
|
| 344 | - $this->expectException(SetupException::class); |
|
| 345 | - $this->getAttributes(ExtendAnnotated::class, ['diWrongAttrType']); |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - public function testContainerAnnotationWrongClassType() |
|
| 349 | - { |
|
| 350 | - $this->expectException(SetupException::class); |
|
| 351 | - $this->getAttributes(ExtendAnnotated::class, ['diWrongClassType']); |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - public function testContainerAnnotationWrongVarCount() |
|
| 355 | - { |
|
| 356 | - $this->expectException(SetupException::class); |
|
| 357 | - $this->getAttributes(ExtendAnnotated::class, ['diWrongVarCount']); |
|
| 358 | - } |
|
| 263 | +public function testClassExcludeAnnotation() |
|
| 264 | +{ |
|
| 265 | +$xMetadata = $this->getAttributes(ClassExcluded::class, |
|
| 266 | +['doNot', 'withBags', 'cbSingle']); |
|
| 267 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 268 | +$aProperties = $xMetadata->getProperties(); |
|
| 269 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 270 | + |
|
| 271 | +$this->assertTrue($bExcluded); |
|
| 272 | +$this->assertEmpty($aProperties); |
|
| 273 | +$this->assertEmpty($aExcluded); |
|
| 274 | +} |
|
| 275 | + |
|
| 276 | +public function testExcludeAnnotationError() |
|
| 277 | +{ |
|
| 278 | +$this->expectException(SetupException::class); |
|
| 279 | +$this->getAttributes(ExtendAnnotated::class, ['doNotError']); |
|
| 280 | +} |
|
| 281 | + |
|
| 282 | +public function testDatabagAnnotationError() |
|
| 283 | +{ |
|
| 284 | +$this->expectException(SetupException::class); |
|
| 285 | +$this->getAttributes(ExtendAnnotated::class, ['withBagsError']); |
|
| 286 | +} |
|
| 287 | + |
|
| 288 | +public function testUploadAnnotationWrongName() |
|
| 289 | +{ |
|
| 290 | +$this->expectException(SetupException::class); |
|
| 291 | +$this->getAttributes(ExtendAnnotated::class, ['saveFilesWrongName']); |
|
| 292 | +} |
|
| 293 | + |
|
| 294 | +public function testUploadAnnotationMultiple() |
|
| 295 | +{ |
|
| 296 | +$this->expectException(SetupException::class); |
|
| 297 | +$this->getAttributes(ExtendAnnotated::class, ['saveFilesMultiple']); |
|
| 298 | +} |
|
| 299 | + |
|
| 300 | +public function testCallbacksBeforeAnnotationNoCall() |
|
| 301 | +{ |
|
| 302 | +$this->expectException(SetupException::class); |
|
| 303 | +$this->getAttributes(ExtendAnnotated::class, ['cbBeforeNoCall']); |
|
| 304 | +} |
|
| 305 | + |
|
| 306 | +public function testCallbacksBeforeAnnotationUnknownAttr() |
|
| 307 | +{ |
|
| 308 | +$this->expectException(SetupException::class); |
|
| 309 | +$this->getAttributes(ExtendAnnotated::class, ['cbBeforeUnknownAttr']); |
|
| 310 | +} |
|
| 311 | + |
|
| 312 | +public function testCallbacksBeforeAnnotationWrongAttrType() |
|
| 313 | +{ |
|
| 314 | +$this->expectException(SetupException::class); |
|
| 315 | +$this->getAttributes(ExtendAnnotated::class, ['cbBeforeWrongAttrType']); |
|
| 316 | +} |
|
| 317 | + |
|
| 318 | +public function testCallbacksAfterAnnotationNoCall() |
|
| 319 | +{ |
|
| 320 | +$this->expectException(SetupException::class); |
|
| 321 | +$this->getAttributes(ExtendAnnotated::class, ['cbAfterNoCall']); |
|
| 322 | +} |
|
| 323 | + |
|
| 324 | +public function testCallbacksAfterAnnotationUnknownAttr() |
|
| 325 | +{ |
|
| 326 | +$this->expectException(SetupException::class); |
|
| 327 | +$this->getAttributes(ExtendAnnotated::class, ['cbAfterUnknownAttr']); |
|
| 328 | +} |
|
| 329 | + |
|
| 330 | +public function testCallbacksAfterAnnotationWrongAttrType() |
|
| 331 | +{ |
|
| 332 | +$this->expectException(SetupException::class); |
|
| 333 | +$this->getAttributes(ExtendAnnotated::class, ['cbAfterWrongAttrType']); |
|
| 334 | +} |
|
| 335 | + |
|
| 336 | +public function testContainerAnnotationUnknownAttr() |
|
| 337 | +{ |
|
| 338 | +$this->expectException(SetupException::class); |
|
| 339 | +$this->getAttributes(ExtendAnnotated::class, ['diUnknownAttr']); |
|
| 340 | +} |
|
| 341 | + |
|
| 342 | +public function testContainerAnnotationWrongAttrType() |
|
| 343 | +{ |
|
| 344 | +$this->expectException(SetupException::class); |
|
| 345 | +$this->getAttributes(ExtendAnnotated::class, ['diWrongAttrType']); |
|
| 346 | +} |
|
| 347 | + |
|
| 348 | +public function testContainerAnnotationWrongClassType() |
|
| 349 | +{ |
|
| 350 | +$this->expectException(SetupException::class); |
|
| 351 | +$this->getAttributes(ExtendAnnotated::class, ['diWrongClassType']); |
|
| 352 | +} |
|
| 353 | + |
|
| 354 | +public function testContainerAnnotationWrongVarCount() |
|
| 355 | +{ |
|
| 356 | +$this->expectException(SetupException::class); |
|
| 357 | +$this->getAttributes(ExtendAnnotated::class, ['diWrongVarCount']); |
|
| 358 | +} |
|
| 359 | 359 | } |
@@ -16,382 +16,382 @@ |
||
| 16 | 16 | |
| 17 | 17 | class AnnotationTest extends TestCase |
| 18 | 18 | { |
| 19 | - use AnnotationTrait; |
|
| 19 | +use AnnotationTrait; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 21 | +/** |
|
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - protected $sCacheDir; |
|
| 24 | +protected $sCacheDir; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * @throws SetupException |
| 28 | 28 | */ |
| 29 | - public function setUp(): void |
|
| 30 | - { |
|
| 31 | - $this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 32 | - @mkdir($this->sCacheDir); |
|
| 29 | +public function setUp(): void |
|
| 30 | +{ |
|
| 31 | +$this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 32 | +@mkdir($this->sCacheDir); |
|
| 33 | 33 | |
| 34 | - jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 35 | - _register(); |
|
| 34 | +jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 35 | +_register(); |
|
| 36 | 36 | |
| 37 | - jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 38 | - } |
|
| 37 | +jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 38 | +} |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @throws SetupException |
| 42 | 42 | */ |
| 43 | - public function tearDown(): void |
|
| 44 | - { |
|
| 45 | - jaxon()->reset(); |
|
| 46 | - parent::tearDown(); |
|
| 47 | - |
|
| 48 | - // Delete the temp dir and all its content |
|
| 49 | - $aFiles = scandir($this->sCacheDir); |
|
| 50 | - foreach ($aFiles as $sFile) |
|
| 51 | - { |
|
| 52 | - if($sFile !== '.' && $sFile !== '..') |
|
| 53 | - { |
|
| 54 | - @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - @rmdir($this->sCacheDir); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - /** |
|
| 43 | +public function tearDown(): void |
|
| 44 | +{ |
|
| 45 | +jaxon()->reset(); |
|
| 46 | +parent::tearDown(); |
|
| 47 | + |
|
| 48 | +// Delete the temp dir and all its content |
|
| 49 | +$aFiles = scandir($this->sCacheDir); |
|
| 50 | +foreach ($aFiles as $sFile) |
|
| 51 | +{ |
|
| 52 | +if($sFile !== '.' && $sFile !== '..') |
|
| 53 | +{ |
|
| 54 | + @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 55 | +} |
|
| 56 | +} |
|
| 57 | +@rmdir($this->sCacheDir); |
|
| 58 | +} |
|
| 59 | + |
|
| 60 | +/** |
|
| 61 | 61 | * @throws SetupException |
| 62 | 62 | */ |
| 63 | - public function testUploadAndExcludeAnnotation() |
|
| 64 | - { |
|
| 65 | - $xMetadata = $this->getAttributes(Annotated::class, ['saveFiles', 'doNot']); |
|
| 66 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 67 | - $aProperties = $xMetadata->getProperties(); |
|
| 68 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 63 | +public function testUploadAndExcludeAnnotation() |
|
| 64 | +{ |
|
| 65 | +$xMetadata = $this->getAttributes(Annotated::class, ['saveFiles', 'doNot']); |
|
| 66 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 67 | +$aProperties = $xMetadata->getProperties(); |
|
| 68 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 69 | 69 | |
| 70 | - $this->assertFalse($bExcluded); |
|
| 70 | +$this->assertFalse($bExcluded); |
|
| 71 | 71 | |
| 72 | - $this->assertCount(1, $aProperties); |
|
| 73 | - $this->assertArrayHasKey('saveFiles', $aProperties); |
|
| 74 | - $this->assertCount(1, $aProperties['saveFiles']); |
|
| 75 | - $this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']); |
|
| 72 | +$this->assertCount(1, $aProperties); |
|
| 73 | +$this->assertArrayHasKey('saveFiles', $aProperties); |
|
| 74 | +$this->assertCount(1, $aProperties['saveFiles']); |
|
| 75 | +$this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']); |
|
| 76 | 76 | |
| 77 | - $this->assertCount(1, $aExcluded); |
|
| 78 | - $this->assertEquals('doNot', $aExcluded[0]); |
|
| 79 | - } |
|
| 77 | +$this->assertCount(1, $aExcluded); |
|
| 78 | +$this->assertEquals('doNot', $aExcluded[0]); |
|
| 79 | +} |
|
| 80 | 80 | |
| 81 | - /** |
|
| 81 | +/** |
|
| 82 | 82 | * @throws SetupException |
| 83 | 83 | */ |
| 84 | - public function testDatabagAnnotation() |
|
| 85 | - { |
|
| 86 | - $xMetadata = $this->getAttributes(Annotated::class, ['withBags']); |
|
| 87 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 88 | - $aProperties = $xMetadata->getProperties(); |
|
| 89 | - |
|
| 90 | - $this->assertFalse($bExcluded); |
|
| 91 | - |
|
| 92 | - $this->assertCount(1, $aProperties); |
|
| 93 | - $this->assertArrayHasKey('withBags', $aProperties); |
|
| 94 | - $this->assertCount(1, $aProperties['withBags']); |
|
| 95 | - $this->assertCount(2, $aProperties['withBags']['bags']); |
|
| 96 | - $this->assertEquals('user.name', $aProperties['withBags']['bags'][0]); |
|
| 97 | - $this->assertEquals('page.number', $aProperties['withBags']['bags'][1]); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 84 | +public function testDatabagAnnotation() |
|
| 85 | +{ |
|
| 86 | +$xMetadata = $this->getAttributes(Annotated::class, ['withBags']); |
|
| 87 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 88 | +$aProperties = $xMetadata->getProperties(); |
|
| 89 | + |
|
| 90 | +$this->assertFalse($bExcluded); |
|
| 91 | + |
|
| 92 | +$this->assertCount(1, $aProperties); |
|
| 93 | +$this->assertArrayHasKey('withBags', $aProperties); |
|
| 94 | +$this->assertCount(1, $aProperties['withBags']); |
|
| 95 | +$this->assertCount(2, $aProperties['withBags']['bags']); |
|
| 96 | +$this->assertEquals('user.name', $aProperties['withBags']['bags'][0]); |
|
| 97 | +$this->assertEquals('page.number', $aProperties['withBags']['bags'][1]); |
|
| 98 | +} |
|
| 99 | + |
|
| 100 | +/** |
|
| 101 | 101 | * @throws SetupException |
| 102 | 102 | */ |
| 103 | - public function testServerCallbacksAnnotation() |
|
| 104 | - { |
|
| 105 | - $xMetadata = $this->getAttributes(Annotated::class, |
|
| 106 | - ['cbSingle', 'cbMultiple', 'cbParams']); |
|
| 107 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 108 | - $aProperties = $xMetadata->getProperties(); |
|
| 109 | - |
|
| 110 | - $this->assertFalse($bExcluded); |
|
| 111 | - |
|
| 112 | - $this->assertCount(3, $aProperties); |
|
| 113 | - $this->assertArrayHasKey('cbSingle', $aProperties); |
|
| 114 | - $this->assertArrayHasKey('cbMultiple', $aProperties); |
|
| 115 | - $this->assertArrayHasKey('cbParams', $aProperties); |
|
| 116 | - |
|
| 117 | - $this->assertCount(1, $aProperties['cbSingle']['__before']); |
|
| 118 | - $this->assertCount(2, $aProperties['cbMultiple']['__before']); |
|
| 119 | - $this->assertCount(2, $aProperties['cbParams']['__before']); |
|
| 120 | - $this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']); |
|
| 121 | - $this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']); |
|
| 122 | - $this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']); |
|
| 123 | - $this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']); |
|
| 124 | - $this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']); |
|
| 125 | - $this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']); |
|
| 126 | - $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']); |
|
| 127 | - $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']); |
|
| 128 | - $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']); |
|
| 129 | - $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']); |
|
| 130 | - |
|
| 131 | - $this->assertCount(1, $aProperties['cbSingle']['__after']); |
|
| 132 | - $this->assertCount(3, $aProperties['cbMultiple']['__after']); |
|
| 133 | - $this->assertCount(1, $aProperties['cbParams']['__after']); |
|
| 134 | - $this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']); |
|
| 135 | - $this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']); |
|
| 136 | - $this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']); |
|
| 137 | - $this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']); |
|
| 138 | - $this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']); |
|
| 139 | - $this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']); |
|
| 140 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']); |
|
| 141 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']); |
|
| 142 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']); |
|
| 143 | - $this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 103 | +public function testServerCallbacksAnnotation() |
|
| 104 | +{ |
|
| 105 | +$xMetadata = $this->getAttributes(Annotated::class, |
|
| 106 | +['cbSingle', 'cbMultiple', 'cbParams']); |
|
| 107 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 108 | +$aProperties = $xMetadata->getProperties(); |
|
| 109 | + |
|
| 110 | +$this->assertFalse($bExcluded); |
|
| 111 | + |
|
| 112 | +$this->assertCount(3, $aProperties); |
|
| 113 | +$this->assertArrayHasKey('cbSingle', $aProperties); |
|
| 114 | +$this->assertArrayHasKey('cbMultiple', $aProperties); |
|
| 115 | +$this->assertArrayHasKey('cbParams', $aProperties); |
|
| 116 | + |
|
| 117 | +$this->assertCount(1, $aProperties['cbSingle']['__before']); |
|
| 118 | +$this->assertCount(2, $aProperties['cbMultiple']['__before']); |
|
| 119 | +$this->assertCount(2, $aProperties['cbParams']['__before']); |
|
| 120 | +$this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']); |
|
| 121 | +$this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']); |
|
| 122 | +$this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']); |
|
| 123 | +$this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']); |
|
| 124 | +$this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']); |
|
| 125 | +$this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']); |
|
| 126 | +$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']); |
|
| 127 | +$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']); |
|
| 128 | +$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']); |
|
| 129 | +$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']); |
|
| 130 | + |
|
| 131 | +$this->assertCount(1, $aProperties['cbSingle']['__after']); |
|
| 132 | +$this->assertCount(3, $aProperties['cbMultiple']['__after']); |
|
| 133 | +$this->assertCount(1, $aProperties['cbParams']['__after']); |
|
| 134 | +$this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']); |
|
| 135 | +$this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']); |
|
| 136 | +$this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']); |
|
| 137 | +$this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']); |
|
| 138 | +$this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']); |
|
| 139 | +$this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']); |
|
| 140 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']); |
|
| 141 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']); |
|
| 142 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']); |
|
| 143 | +$this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']); |
|
| 144 | +} |
|
| 145 | + |
|
| 146 | +/** |
|
| 147 | 147 | * @throws SetupException |
| 148 | 148 | */ |
| 149 | - public function testContainerAnnotation() |
|
| 150 | - { |
|
| 151 | - $xMetadata = $this->getAttributes(Annotated::class, ['di1', 'di2']); |
|
| 152 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 153 | - $aProperties = $xMetadata->getProperties(); |
|
| 154 | - |
|
| 155 | - $this->assertFalse($bExcluded); |
|
| 156 | - |
|
| 157 | - $this->assertCount(2, $aProperties); |
|
| 158 | - $this->assertArrayHasKey('di1', $aProperties); |
|
| 159 | - $this->assertArrayHasKey('di2', $aProperties); |
|
| 160 | - $this->assertCount(2, $aProperties['di1']['__di']); |
|
| 161 | - $this->assertCount(2, $aProperties['di2']['__di']); |
|
| 162 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']); |
|
| 163 | - $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']); |
|
| 164 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']); |
|
| 165 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - /** |
|
| 149 | +public function testContainerAnnotation() |
|
| 150 | +{ |
|
| 151 | +$xMetadata = $this->getAttributes(Annotated::class, ['di1', 'di2']); |
|
| 152 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 153 | +$aProperties = $xMetadata->getProperties(); |
|
| 154 | + |
|
| 155 | +$this->assertFalse($bExcluded); |
|
| 156 | + |
|
| 157 | +$this->assertCount(2, $aProperties); |
|
| 158 | +$this->assertArrayHasKey('di1', $aProperties); |
|
| 159 | +$this->assertArrayHasKey('di2', $aProperties); |
|
| 160 | +$this->assertCount(2, $aProperties['di1']['__di']); |
|
| 161 | +$this->assertCount(2, $aProperties['di2']['__di']); |
|
| 162 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']); |
|
| 163 | +$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']); |
|
| 164 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']); |
|
| 165 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']); |
|
| 166 | +} |
|
| 167 | + |
|
| 168 | +/** |
|
| 169 | 169 | * @throws SetupException |
| 170 | 170 | */ |
| 171 | - public function testClassAnnotation() |
|
| 172 | - { |
|
| 173 | - $xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 174 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 175 | - $aProperties = $xMetadata->getProperties(); |
|
| 176 | - |
|
| 177 | - $this->assertFalse($bExcluded); |
|
| 178 | - |
|
| 179 | - $this->assertCount(1, $aProperties); |
|
| 180 | - $this->assertArrayHasKey('*', $aProperties); |
|
| 181 | - $this->assertCount(5, $aProperties['*']); |
|
| 182 | - $this->assertArrayHasKey('bags', $aProperties['*']); |
|
| 183 | - $this->assertArrayHasKey('callback', $aProperties['*']); |
|
| 184 | - $this->assertArrayHasKey('__before', $aProperties['*']); |
|
| 185 | - $this->assertArrayHasKey('__after', $aProperties['*']); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** |
|
| 171 | +public function testClassAnnotation() |
|
| 172 | +{ |
|
| 173 | +$xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 174 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 175 | +$aProperties = $xMetadata->getProperties(); |
|
| 176 | + |
|
| 177 | +$this->assertFalse($bExcluded); |
|
| 178 | + |
|
| 179 | +$this->assertCount(1, $aProperties); |
|
| 180 | +$this->assertArrayHasKey('*', $aProperties); |
|
| 181 | +$this->assertCount(5, $aProperties['*']); |
|
| 182 | +$this->assertArrayHasKey('bags', $aProperties['*']); |
|
| 183 | +$this->assertArrayHasKey('callback', $aProperties['*']); |
|
| 184 | +$this->assertArrayHasKey('__before', $aProperties['*']); |
|
| 185 | +$this->assertArrayHasKey('__after', $aProperties['*']); |
|
| 186 | +} |
|
| 187 | + |
|
| 188 | +/** |
|
| 189 | 189 | * @throws SetupException |
| 190 | 190 | */ |
| 191 | - public function testClassBagsAnnotation() |
|
| 192 | - { |
|
| 193 | - $xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 194 | - $aProperties = $xMetadata->getProperties(); |
|
| 191 | +public function testClassBagsAnnotation() |
|
| 192 | +{ |
|
| 193 | +$xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 194 | +$aProperties = $xMetadata->getProperties(); |
|
| 195 | 195 | |
| 196 | - $this->assertCount(2, $aProperties['*']['bags']); |
|
| 197 | - $this->assertEquals('user.name', $aProperties['*']['bags'][0]); |
|
| 198 | - $this->assertEquals('page.number', $aProperties['*']['bags'][1]); |
|
| 199 | - } |
|
| 196 | +$this->assertCount(2, $aProperties['*']['bags']); |
|
| 197 | +$this->assertEquals('user.name', $aProperties['*']['bags'][0]); |
|
| 198 | +$this->assertEquals('page.number', $aProperties['*']['bags'][1]); |
|
| 199 | +} |
|
| 200 | 200 | |
| 201 | - /** |
|
| 201 | +/** |
|
| 202 | 202 | * @throws SetupException |
| 203 | 203 | */ |
| 204 | - public function testClassCallbackAnnotation() |
|
| 205 | - { |
|
| 206 | - $xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 207 | - $aProperties = $xMetadata->getProperties(); |
|
| 204 | +public function testClassCallbackAnnotation() |
|
| 205 | +{ |
|
| 206 | +$xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 207 | +$aProperties = $xMetadata->getProperties(); |
|
| 208 | 208 | |
| 209 | - $this->assertIsArray($aProperties['*']['callback']); |
|
| 210 | - $this->assertEquals('jaxon.callback.global', $aProperties['*']['callback'][0]); |
|
| 211 | - } |
|
| 209 | +$this->assertIsArray($aProperties['*']['callback']); |
|
| 210 | +$this->assertEquals('jaxon.callback.global', $aProperties['*']['callback'][0]); |
|
| 211 | +} |
|
| 212 | 212 | |
| 213 | - /** |
|
| 213 | +/** |
|
| 214 | 214 | * @throws SetupException |
| 215 | 215 | */ |
| 216 | - public function testClassBeforeAnnotation() |
|
| 217 | - { |
|
| 218 | - $xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 219 | - $aProperties = $xMetadata->getProperties(); |
|
| 220 | - |
|
| 221 | - $this->assertCount(2, $aProperties['*']['__before']); |
|
| 222 | - $this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']); |
|
| 223 | - $this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']); |
|
| 224 | - $this->assertIsArray($aProperties['*']['__before']['funcBefore1']); |
|
| 225 | - $this->assertIsArray($aProperties['*']['__before']['funcBefore2']); |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - /** |
|
| 216 | +public function testClassBeforeAnnotation() |
|
| 217 | +{ |
|
| 218 | +$xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 219 | +$aProperties = $xMetadata->getProperties(); |
|
| 220 | + |
|
| 221 | +$this->assertCount(2, $aProperties['*']['__before']); |
|
| 222 | +$this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']); |
|
| 223 | +$this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']); |
|
| 224 | +$this->assertIsArray($aProperties['*']['__before']['funcBefore1']); |
|
| 225 | +$this->assertIsArray($aProperties['*']['__before']['funcBefore2']); |
|
| 226 | +} |
|
| 227 | + |
|
| 228 | +/** |
|
| 229 | 229 | * @throws SetupException |
| 230 | 230 | */ |
| 231 | - public function testClassAfterAnnotation() |
|
| 232 | - { |
|
| 233 | - $xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 234 | - $aProperties = $xMetadata->getProperties(); |
|
| 235 | - |
|
| 236 | - $this->assertCount(3, $aProperties['*']['__after']); |
|
| 237 | - $this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']); |
|
| 238 | - $this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']); |
|
| 239 | - $this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']); |
|
| 240 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter1']); |
|
| 241 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter2']); |
|
| 242 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter3']); |
|
| 243 | - } |
|
| 244 | - |
|
| 245 | - /** |
|
| 231 | +public function testClassAfterAnnotation() |
|
| 232 | +{ |
|
| 233 | +$xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 234 | +$aProperties = $xMetadata->getProperties(); |
|
| 235 | + |
|
| 236 | +$this->assertCount(3, $aProperties['*']['__after']); |
|
| 237 | +$this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']); |
|
| 238 | +$this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']); |
|
| 239 | +$this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']); |
|
| 240 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter1']); |
|
| 241 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter2']); |
|
| 242 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter3']); |
|
| 243 | +} |
|
| 244 | + |
|
| 245 | +/** |
|
| 246 | 246 | * @throws SetupException |
| 247 | 247 | */ |
| 248 | - public function testClassDiAnnotation() |
|
| 249 | - { |
|
| 250 | - $xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 251 | - $aProperties = $xMetadata->getProperties(); |
|
| 252 | - |
|
| 253 | - $this->assertCount(3, $aProperties['*']['__di']); |
|
| 254 | - $this->assertArrayHasKey('colorService', $aProperties['*']['__di']); |
|
| 255 | - $this->assertArrayHasKey('textService', $aProperties['*']['__di']); |
|
| 256 | - $this->assertArrayHasKey('fontService', $aProperties['*']['__di']); |
|
| 257 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']); |
|
| 258 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']); |
|
| 259 | - $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - /** |
|
| 248 | +public function testClassDiAnnotation() |
|
| 249 | +{ |
|
| 250 | +$xMetadata = $this->getAttributes(ClassAnnotated::class, []); |
|
| 251 | +$aProperties = $xMetadata->getProperties(); |
|
| 252 | + |
|
| 253 | +$this->assertCount(3, $aProperties['*']['__di']); |
|
| 254 | +$this->assertArrayHasKey('colorService', $aProperties['*']['__di']); |
|
| 255 | +$this->assertArrayHasKey('textService', $aProperties['*']['__di']); |
|
| 256 | +$this->assertArrayHasKey('fontService', $aProperties['*']['__di']); |
|
| 257 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']); |
|
| 258 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']); |
|
| 259 | +$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 260 | +} |
|
| 261 | + |
|
| 262 | +/** |
|
| 263 | 263 | * @throws SetupException |
| 264 | 264 | */ |
| 265 | - public function testClassExcludeAnnotation() |
|
| 266 | - { |
|
| 267 | - $xMetadata = $this->getAttributes(ClassExcluded::class, |
|
| 268 | - ['doNot', 'withBags', 'cbSingle']); |
|
| 269 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 270 | - $aProperties = $xMetadata->getProperties(); |
|
| 271 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 272 | - |
|
| 273 | - $this->assertTrue($bExcluded); |
|
| 274 | - $this->assertEmpty($aProperties); |
|
| 275 | - $this->assertEmpty($aExcluded); |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - public function testExcludeAnnotationError() |
|
| 279 | - { |
|
| 280 | - $this->expectException(SetupException::class); |
|
| 281 | - $this->getAttributes(Annotated::class, ['doNotError']); |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - public function testDatabagAnnotationError() |
|
| 285 | - { |
|
| 286 | - $this->expectException(SetupException::class); |
|
| 287 | - $this->getAttributes(Annotated::class, ['withBagsError']); |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - public function testUploadAnnotationWrongName() |
|
| 291 | - { |
|
| 292 | - $this->expectException(SetupException::class); |
|
| 293 | - $this->getAttributes(Annotated::class, ['saveFilesWrongName']); |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - public function testUploadAnnotationMultiple() |
|
| 297 | - { |
|
| 298 | - $this->expectException(SetupException::class); |
|
| 299 | - $this->getAttributes(Annotated::class, ['saveFilesMultiple']); |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - public function testCallbacksBeforeAnnotationNoCall() |
|
| 303 | - { |
|
| 304 | - $this->expectException(SetupException::class); |
|
| 305 | - $this->getAttributes(Annotated::class, ['cbBeforeNoCall']); |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - public function testCallbacksBeforeAnnotationUnknownAttr() |
|
| 309 | - { |
|
| 310 | - $this->expectException(SetupException::class); |
|
| 311 | - $this->getAttributes(Annotated::class, ['cbBeforeUnknownAttr']); |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - public function testCallbacksBeforeAnnotationWrongAttrType() |
|
| 315 | - { |
|
| 316 | - $this->expectException(SetupException::class); |
|
| 317 | - $this->getAttributes(Annotated::class, ['cbBeforeWrongAttrType']); |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - public function testCallbacksAfterAnnotationNoCall() |
|
| 321 | - { |
|
| 322 | - $this->expectException(SetupException::class); |
|
| 323 | - $this->getAttributes(Annotated::class, ['cbAfterNoCall']); |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - public function testCallbacksAfterAnnotationUnknownAttr() |
|
| 327 | - { |
|
| 328 | - $this->expectException(SetupException::class); |
|
| 329 | - $this->getAttributes(Annotated::class, ['cbAfterUnknownAttr']); |
|
| 330 | - } |
|
| 331 | - |
|
| 332 | - public function testCallbacksAfterAnnotationWrongAttrType() |
|
| 333 | - { |
|
| 334 | - $this->expectException(SetupException::class); |
|
| 335 | - $this->getAttributes(Annotated::class, ['cbAfterWrongAttrType']); |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - public function testContainerAnnotationUnknownAttr() |
|
| 339 | - { |
|
| 340 | - $this->expectException(SetupException::class); |
|
| 341 | - $this->getAttributes(Annotated::class, ['diUnknownAttr']); |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - public function testContainerAnnotationWrongAttrType() |
|
| 345 | - { |
|
| 346 | - $this->expectException(SetupException::class); |
|
| 347 | - $this->getAttributes(Annotated::class, ['diWrongAttrType']); |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - public function testContainerAnnotationWrongClassType() |
|
| 351 | - { |
|
| 352 | - $this->expectException(SetupException::class); |
|
| 353 | - $this->getAttributes(Annotated::class, ['diWrongClassType']); |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - public function testContainerAnnotationWrongVarCount() |
|
| 357 | - { |
|
| 358 | - $this->expectException(SetupException::class); |
|
| 359 | - $this->getAttributes(Annotated::class, ['diWrongVarCount']); |
|
| 360 | - } |
|
| 361 | - |
|
| 362 | - public function testContainerErrorTwiceOnProp() |
|
| 363 | - { |
|
| 364 | - $this->expectException(SetupException::class); |
|
| 365 | - $this->getAttributes(ContainerError::class, [], ['prop']); |
|
| 366 | - } |
|
| 367 | - |
|
| 368 | - public function testCallbackErrorNoName() |
|
| 369 | - { |
|
| 370 | - $this->expectException(SetupException::class); |
|
| 371 | - $this->getAttributes(CallbackError::class, ['noName']); |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - public function testCallbackErrorWrongNameType() |
|
| 375 | - { |
|
| 376 | - $this->expectException(SetupException::class); |
|
| 377 | - $this->getAttributes(CallbackError::class, ['wrongNameType']); |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - public function testCallbackErrorWrongNameAttr() |
|
| 381 | - { |
|
| 382 | - $this->expectException(SetupException::class); |
|
| 383 | - $this->getAttributes(CallbackError::class, ['wrongNameAttr']); |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - public function testCallbackErrorNameWithSpace() |
|
| 387 | - { |
|
| 388 | - $this->expectException(SetupException::class); |
|
| 389 | - $this->getAttributes(CallbackError::class, ['nameWithSpace']); |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - public function testCallbackErrorStartWithInt() |
|
| 393 | - { |
|
| 394 | - $this->expectException(SetupException::class); |
|
| 395 | - $this->getAttributes(CallbackError::class, ['startWithInt']); |
|
| 396 | - } |
|
| 265 | +public function testClassExcludeAnnotation() |
|
| 266 | +{ |
|
| 267 | +$xMetadata = $this->getAttributes(ClassExcluded::class, |
|
| 268 | +['doNot', 'withBags', 'cbSingle']); |
|
| 269 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 270 | +$aProperties = $xMetadata->getProperties(); |
|
| 271 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 272 | + |
|
| 273 | +$this->assertTrue($bExcluded); |
|
| 274 | +$this->assertEmpty($aProperties); |
|
| 275 | +$this->assertEmpty($aExcluded); |
|
| 276 | +} |
|
| 277 | + |
|
| 278 | +public function testExcludeAnnotationError() |
|
| 279 | +{ |
|
| 280 | +$this->expectException(SetupException::class); |
|
| 281 | +$this->getAttributes(Annotated::class, ['doNotError']); |
|
| 282 | +} |
|
| 283 | + |
|
| 284 | +public function testDatabagAnnotationError() |
|
| 285 | +{ |
|
| 286 | +$this->expectException(SetupException::class); |
|
| 287 | +$this->getAttributes(Annotated::class, ['withBagsError']); |
|
| 288 | +} |
|
| 289 | + |
|
| 290 | +public function testUploadAnnotationWrongName() |
|
| 291 | +{ |
|
| 292 | +$this->expectException(SetupException::class); |
|
| 293 | +$this->getAttributes(Annotated::class, ['saveFilesWrongName']); |
|
| 294 | +} |
|
| 295 | + |
|
| 296 | +public function testUploadAnnotationMultiple() |
|
| 297 | +{ |
|
| 298 | +$this->expectException(SetupException::class); |
|
| 299 | +$this->getAttributes(Annotated::class, ['saveFilesMultiple']); |
|
| 300 | +} |
|
| 301 | + |
|
| 302 | +public function testCallbacksBeforeAnnotationNoCall() |
|
| 303 | +{ |
|
| 304 | +$this->expectException(SetupException::class); |
|
| 305 | +$this->getAttributes(Annotated::class, ['cbBeforeNoCall']); |
|
| 306 | +} |
|
| 307 | + |
|
| 308 | +public function testCallbacksBeforeAnnotationUnknownAttr() |
|
| 309 | +{ |
|
| 310 | +$this->expectException(SetupException::class); |
|
| 311 | +$this->getAttributes(Annotated::class, ['cbBeforeUnknownAttr']); |
|
| 312 | +} |
|
| 313 | + |
|
| 314 | +public function testCallbacksBeforeAnnotationWrongAttrType() |
|
| 315 | +{ |
|
| 316 | +$this->expectException(SetupException::class); |
|
| 317 | +$this->getAttributes(Annotated::class, ['cbBeforeWrongAttrType']); |
|
| 318 | +} |
|
| 319 | + |
|
| 320 | +public function testCallbacksAfterAnnotationNoCall() |
|
| 321 | +{ |
|
| 322 | +$this->expectException(SetupException::class); |
|
| 323 | +$this->getAttributes(Annotated::class, ['cbAfterNoCall']); |
|
| 324 | +} |
|
| 325 | + |
|
| 326 | +public function testCallbacksAfterAnnotationUnknownAttr() |
|
| 327 | +{ |
|
| 328 | +$this->expectException(SetupException::class); |
|
| 329 | +$this->getAttributes(Annotated::class, ['cbAfterUnknownAttr']); |
|
| 330 | +} |
|
| 331 | + |
|
| 332 | +public function testCallbacksAfterAnnotationWrongAttrType() |
|
| 333 | +{ |
|
| 334 | +$this->expectException(SetupException::class); |
|
| 335 | +$this->getAttributes(Annotated::class, ['cbAfterWrongAttrType']); |
|
| 336 | +} |
|
| 337 | + |
|
| 338 | +public function testContainerAnnotationUnknownAttr() |
|
| 339 | +{ |
|
| 340 | +$this->expectException(SetupException::class); |
|
| 341 | +$this->getAttributes(Annotated::class, ['diUnknownAttr']); |
|
| 342 | +} |
|
| 343 | + |
|
| 344 | +public function testContainerAnnotationWrongAttrType() |
|
| 345 | +{ |
|
| 346 | +$this->expectException(SetupException::class); |
|
| 347 | +$this->getAttributes(Annotated::class, ['diWrongAttrType']); |
|
| 348 | +} |
|
| 349 | + |
|
| 350 | +public function testContainerAnnotationWrongClassType() |
|
| 351 | +{ |
|
| 352 | +$this->expectException(SetupException::class); |
|
| 353 | +$this->getAttributes(Annotated::class, ['diWrongClassType']); |
|
| 354 | +} |
|
| 355 | + |
|
| 356 | +public function testContainerAnnotationWrongVarCount() |
|
| 357 | +{ |
|
| 358 | +$this->expectException(SetupException::class); |
|
| 359 | +$this->getAttributes(Annotated::class, ['diWrongVarCount']); |
|
| 360 | +} |
|
| 361 | + |
|
| 362 | +public function testContainerErrorTwiceOnProp() |
|
| 363 | +{ |
|
| 364 | +$this->expectException(SetupException::class); |
|
| 365 | +$this->getAttributes(ContainerError::class, [], ['prop']); |
|
| 366 | +} |
|
| 367 | + |
|
| 368 | +public function testCallbackErrorNoName() |
|
| 369 | +{ |
|
| 370 | +$this->expectException(SetupException::class); |
|
| 371 | +$this->getAttributes(CallbackError::class, ['noName']); |
|
| 372 | +} |
|
| 373 | + |
|
| 374 | +public function testCallbackErrorWrongNameType() |
|
| 375 | +{ |
|
| 376 | +$this->expectException(SetupException::class); |
|
| 377 | +$this->getAttributes(CallbackError::class, ['wrongNameType']); |
|
| 378 | +} |
|
| 379 | + |
|
| 380 | +public function testCallbackErrorWrongNameAttr() |
|
| 381 | +{ |
|
| 382 | +$this->expectException(SetupException::class); |
|
| 383 | +$this->getAttributes(CallbackError::class, ['wrongNameAttr']); |
|
| 384 | +} |
|
| 385 | + |
|
| 386 | +public function testCallbackErrorNameWithSpace() |
|
| 387 | +{ |
|
| 388 | +$this->expectException(SetupException::class); |
|
| 389 | +$this->getAttributes(CallbackError::class, ['nameWithSpace']); |
|
| 390 | +} |
|
| 391 | + |
|
| 392 | +public function testCallbackErrorStartWithInt() |
|
| 393 | +{ |
|
| 394 | +$this->expectException(SetupException::class); |
|
| 395 | +$this->getAttributes(CallbackError::class, ['startWithInt']); |
|
| 396 | +} |
|
| 397 | 397 | } |
@@ -16,133 +16,133 @@ |
||
| 16 | 16 | |
| 17 | 17 | class ComponentTest extends TestCase |
| 18 | 18 | { |
| 19 | - use AnnotationTrait; |
|
| 19 | +use AnnotationTrait; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 21 | +/** |
|
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - private $sCacheDir; |
|
| 24 | +private $sCacheDir; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * @throws SetupException |
| 28 | 28 | */ |
| 29 | - public function setUp(): void |
|
| 30 | - { |
|
| 31 | - $this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 32 | - @mkdir($this->sCacheDir); |
|
| 29 | +public function setUp(): void |
|
| 30 | +{ |
|
| 31 | +$this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 32 | +@mkdir($this->sCacheDir); |
|
| 33 | 33 | |
| 34 | - jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 35 | - _register(); |
|
| 34 | +jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 35 | +_register(); |
|
| 36 | 36 | |
| 37 | - jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 38 | - } |
|
| 37 | +jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 38 | +} |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @throws SetupException |
| 42 | 42 | */ |
| 43 | - public function tearDown(): void |
|
| 44 | - { |
|
| 45 | - jaxon()->reset(); |
|
| 46 | - parent::tearDown(); |
|
| 47 | - |
|
| 48 | - // Delete the temp dir and all its content |
|
| 49 | - $aFiles = scandir($this->sCacheDir); |
|
| 50 | - foreach ($aFiles as $sFile) |
|
| 51 | - { |
|
| 52 | - if($sFile !== '.' && $sFile !== '..') |
|
| 53 | - { |
|
| 54 | - @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - @rmdir($this->sCacheDir); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - /** |
|
| 43 | +public function tearDown(): void |
|
| 44 | +{ |
|
| 45 | +jaxon()->reset(); |
|
| 46 | +parent::tearDown(); |
|
| 47 | + |
|
| 48 | +// Delete the temp dir and all its content |
|
| 49 | +$aFiles = scandir($this->sCacheDir); |
|
| 50 | +foreach ($aFiles as $sFile) |
|
| 51 | +{ |
|
| 52 | +if($sFile !== '.' && $sFile !== '..') |
|
| 53 | +{ |
|
| 54 | + @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 55 | +} |
|
| 56 | +} |
|
| 57 | +@rmdir($this->sCacheDir); |
|
| 58 | +} |
|
| 59 | + |
|
| 60 | +/** |
|
| 61 | 61 | * @throws SetupException |
| 62 | 62 | */ |
| 63 | - public function testNodeComponentExportMethods() |
|
| 64 | - { |
|
| 65 | - $xMetadata = $this->getAttributes(NodeComponent::class, |
|
| 66 | - ['item', 'html', 'render', 'clear', 'visible'], []); |
|
| 67 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 68 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 69 | - $aBaseMethods = $xMetadata->getExportBaseMethods(); |
|
| 70 | - $aOnlyMethods = $xMetadata->getExportOnlyMethods(); |
|
| 71 | - |
|
| 72 | - $this->assertFalse($bExcluded); |
|
| 73 | - $this->assertCount(0, $aExcluded); |
|
| 74 | - $this->assertCount(0, $aBaseMethods); |
|
| 75 | - $this->assertCount(0, $aOnlyMethods); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 63 | +public function testNodeComponentExportMethods() |
|
| 64 | +{ |
|
| 65 | +$xMetadata = $this->getAttributes(NodeComponent::class, |
|
| 66 | +['item', 'html', 'render', 'clear', 'visible'], []); |
|
| 67 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 68 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 69 | +$aBaseMethods = $xMetadata->getExportBaseMethods(); |
|
| 70 | +$aOnlyMethods = $xMetadata->getExportOnlyMethods(); |
|
| 71 | + |
|
| 72 | +$this->assertFalse($bExcluded); |
|
| 73 | +$this->assertCount(0, $aExcluded); |
|
| 74 | +$this->assertCount(0, $aBaseMethods); |
|
| 75 | +$this->assertCount(0, $aOnlyMethods); |
|
| 76 | +} |
|
| 77 | + |
|
| 78 | +/** |
|
| 79 | 79 | * @throws SetupException |
| 80 | 80 | */ |
| 81 | - public function testPageComponentExportMethods() |
|
| 82 | - { |
|
| 83 | - $xMetadata = $this->getAttributes(PageComponent::class, |
|
| 84 | - ['item', 'html', 'render', 'clear', 'visible'], []); |
|
| 85 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 86 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 87 | - $aBaseMethods = $xMetadata->getExportBaseMethods(); |
|
| 88 | - $aOnlyMethods = $xMetadata->getExportOnlyMethods(); |
|
| 89 | - |
|
| 90 | - $this->assertFalse($bExcluded); |
|
| 91 | - $this->assertCount(0, $aExcluded); |
|
| 92 | - $this->assertCount(0, $aBaseMethods); |
|
| 93 | - $this->assertCount(0, $aOnlyMethods); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 81 | +public function testPageComponentExportMethods() |
|
| 82 | +{ |
|
| 83 | +$xMetadata = $this->getAttributes(PageComponent::class, |
|
| 84 | +['item', 'html', 'render', 'clear', 'visible'], []); |
|
| 85 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 86 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 87 | +$aBaseMethods = $xMetadata->getExportBaseMethods(); |
|
| 88 | +$aOnlyMethods = $xMetadata->getExportOnlyMethods(); |
|
| 89 | + |
|
| 90 | +$this->assertFalse($bExcluded); |
|
| 91 | +$this->assertCount(0, $aExcluded); |
|
| 92 | +$this->assertCount(0, $aBaseMethods); |
|
| 93 | +$this->assertCount(0, $aOnlyMethods); |
|
| 94 | +} |
|
| 95 | + |
|
| 96 | +/** |
|
| 97 | 97 | * @throws SetupException |
| 98 | 98 | */ |
| 99 | - public function testFuncComponentExportMethods() |
|
| 100 | - { |
|
| 101 | - $xMetadata = $this->getAttributes(FuncComponent::class, |
|
| 102 | - ['paginator'], []); |
|
| 103 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 104 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 105 | - $aBaseMethods = $xMetadata->getExportBaseMethods(); |
|
| 106 | - $aOnlyMethods = $xMetadata->getExportOnlyMethods(); |
|
| 107 | - |
|
| 108 | - $this->assertFalse($bExcluded); |
|
| 109 | - $this->assertCount(0, $aExcluded); |
|
| 110 | - $this->assertCount(0, $aBaseMethods); |
|
| 111 | - $this->assertCount(0, $aOnlyMethods); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - /** |
|
| 99 | +public function testFuncComponentExportMethods() |
|
| 100 | +{ |
|
| 101 | +$xMetadata = $this->getAttributes(FuncComponent::class, |
|
| 102 | +['paginator'], []); |
|
| 103 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 104 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 105 | +$aBaseMethods = $xMetadata->getExportBaseMethods(); |
|
| 106 | +$aOnlyMethods = $xMetadata->getExportOnlyMethods(); |
|
| 107 | + |
|
| 108 | +$this->assertFalse($bExcluded); |
|
| 109 | +$this->assertCount(0, $aExcluded); |
|
| 110 | +$this->assertCount(0, $aBaseMethods); |
|
| 111 | +$this->assertCount(0, $aOnlyMethods); |
|
| 112 | +} |
|
| 113 | + |
|
| 114 | +/** |
|
| 115 | 115 | * @throws SetupException |
| 116 | 116 | */ |
| 117 | - public function testNodeComponentExportBaseMethods() |
|
| 118 | - { |
|
| 119 | - // The attribute exports the 'html' and 'render' methods, |
|
| 120 | - // but only the 'render' method shall be exported. |
|
| 121 | - $xClass = new ReflectionClass(NodeBaseComponent::class); |
|
| 122 | - $aMethods = ['item', 'html', 'render', 'clear', 'visible']; |
|
| 123 | - $xMetadata = $this->getAttributes($xClass, $aMethods, []); |
|
| 124 | - $aBaseMethods = $xMetadata->getExportBaseMethods(); |
|
| 125 | - |
|
| 126 | - // The 'html' and 'render' methods are returned. |
|
| 127 | - $this->assertCount(2, $aBaseMethods); |
|
| 128 | - |
|
| 129 | - $xOptions = $this->getOptions($xClass); |
|
| 130 | - $aPublicMethods = $xOptions->getPublicMethods(); |
|
| 131 | - |
|
| 132 | - // Only the 'render' method is returned. |
|
| 133 | - $this->assertCount(1, $aPublicMethods); |
|
| 134 | - $this->assertEquals('render', $aPublicMethods[0]); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - // public function testContainerAttributeErrorTwoDi() |
|
| 138 | - // { |
|
| 139 | - // $this->expectException(SetupException::class); |
|
| 140 | - // $this->getAttributes(PropertyAttribute::class, [], ['errorTwoDi']); |
|
| 141 | - // } |
|
| 142 | - |
|
| 143 | - // public function testContainerAttributeErrorDiClass() |
|
| 144 | - // { |
|
| 145 | - // $this->expectException(SetupException::class); |
|
| 146 | - // $this->getAttributes(PropertyAttribute::class, ['errorDiClass']); |
|
| 147 | - // } |
|
| 117 | +public function testNodeComponentExportBaseMethods() |
|
| 118 | +{ |
|
| 119 | +// The attribute exports the 'html' and 'render' methods, |
|
| 120 | +// but only the 'render' method shall be exported. |
|
| 121 | +$xClass = new ReflectionClass(NodeBaseComponent::class); |
|
| 122 | +$aMethods = ['item', 'html', 'render', 'clear', 'visible']; |
|
| 123 | +$xMetadata = $this->getAttributes($xClass, $aMethods, []); |
|
| 124 | +$aBaseMethods = $xMetadata->getExportBaseMethods(); |
|
| 125 | + |
|
| 126 | +// The 'html' and 'render' methods are returned. |
|
| 127 | +$this->assertCount(2, $aBaseMethods); |
|
| 128 | + |
|
| 129 | +$xOptions = $this->getOptions($xClass); |
|
| 130 | +$aPublicMethods = $xOptions->getPublicMethods(); |
|
| 131 | + |
|
| 132 | +// Only the 'render' method is returned. |
|
| 133 | +$this->assertCount(1, $aPublicMethods); |
|
| 134 | +$this->assertEquals('render', $aPublicMethods[0]); |
|
| 135 | +} |
|
| 136 | + |
|
| 137 | +// public function testContainerAttributeErrorTwoDi() |
|
| 138 | +// { |
|
| 139 | +// $this->expectException(SetupException::class); |
|
| 140 | +// $this->getAttributes(PropertyAttribute::class, [], ['errorTwoDi']); |
|
| 141 | +// } |
|
| 142 | + |
|
| 143 | +// public function testContainerAttributeErrorDiClass() |
|
| 144 | +// { |
|
| 145 | +// $this->expectException(SetupException::class); |
|
| 146 | +// $this->getAttributes(PropertyAttribute::class, ['errorDiClass']); |
|
| 147 | +// } |
|
| 148 | 148 | } |
@@ -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\Attr\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\Attr\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\Attr\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\Attr\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\Attr\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\Attr\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\Attr\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\Attr\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\Attr\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\Attr\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 | } |
@@ -16,320 +16,320 @@ |
||
| 16 | 16 | |
| 17 | 17 | class DocBlockAnnotationTest extends TestCase |
| 18 | 18 | { |
| 19 | - use AnnotationTrait; |
|
| 19 | +use AnnotationTrait; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 21 | +/** |
|
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - protected $sCacheDir; |
|
| 24 | +protected $sCacheDir; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * @throws SetupException |
| 28 | 28 | */ |
| 29 | - public function setUp(): void |
|
| 30 | - { |
|
| 31 | - $this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 32 | - @mkdir($this->sCacheDir); |
|
| 29 | +public function setUp(): void |
|
| 30 | +{ |
|
| 31 | +$this->sCacheDir = __DIR__ . '/../tmp'; |
|
| 32 | +@mkdir($this->sCacheDir); |
|
| 33 | 33 | |
| 34 | - jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 35 | - _register(); |
|
| 34 | +jaxon()->di()->getPluginManager()->registerPlugins(); |
|
| 35 | +_register(); |
|
| 36 | 36 | |
| 37 | - jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 38 | - } |
|
| 37 | +jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir); |
|
| 38 | +} |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @throws SetupException |
| 42 | 42 | */ |
| 43 | - public function tearDown(): void |
|
| 44 | - { |
|
| 45 | - jaxon()->reset(); |
|
| 46 | - parent::tearDown(); |
|
| 47 | - |
|
| 48 | - // Delete the temp dir and all its content |
|
| 49 | - $aFiles = scandir($this->sCacheDir); |
|
| 50 | - foreach ($aFiles as $sFile) |
|
| 51 | - { |
|
| 52 | - if($sFile !== '.' && $sFile !== '..') |
|
| 53 | - { |
|
| 54 | - @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - @rmdir($this->sCacheDir); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - /** |
|
| 43 | +public function tearDown(): void |
|
| 44 | +{ |
|
| 45 | +jaxon()->reset(); |
|
| 46 | +parent::tearDown(); |
|
| 47 | + |
|
| 48 | +// Delete the temp dir and all its content |
|
| 49 | +$aFiles = scandir($this->sCacheDir); |
|
| 50 | +foreach ($aFiles as $sFile) |
|
| 51 | +{ |
|
| 52 | +if($sFile !== '.' && $sFile !== '..') |
|
| 53 | +{ |
|
| 54 | + @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
|
| 55 | +} |
|
| 56 | +} |
|
| 57 | +@rmdir($this->sCacheDir); |
|
| 58 | +} |
|
| 59 | + |
|
| 60 | +/** |
|
| 61 | 61 | * @throws SetupException |
| 62 | 62 | */ |
| 63 | - public function testUploadAndExcludeAnnotation() |
|
| 64 | - { |
|
| 65 | - $xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['saveFiles', 'doNot']); |
|
| 66 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 67 | - $aProperties = $xMetadata->getProperties(); |
|
| 68 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 63 | +public function testUploadAndExcludeAnnotation() |
|
| 64 | +{ |
|
| 65 | +$xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['saveFiles', 'doNot']); |
|
| 66 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 67 | +$aProperties = $xMetadata->getProperties(); |
|
| 68 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 69 | 69 | |
| 70 | - $this->assertFalse($bExcluded); |
|
| 70 | +$this->assertFalse($bExcluded); |
|
| 71 | 71 | |
| 72 | - $this->assertCount(1, $aExcluded); |
|
| 73 | - $this->assertEquals('doNot', $aExcluded[0]); |
|
| 72 | +$this->assertCount(1, $aExcluded); |
|
| 73 | +$this->assertEquals('doNot', $aExcluded[0]); |
|
| 74 | 74 | |
| 75 | - $this->assertCount(1, $aProperties); |
|
| 76 | - $this->assertArrayHasKey('saveFiles', $aProperties); |
|
| 77 | - $this->assertCount(1, $aProperties['saveFiles']); |
|
| 78 | - $this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']); |
|
| 79 | - } |
|
| 75 | +$this->assertCount(1, $aProperties); |
|
| 76 | +$this->assertArrayHasKey('saveFiles', $aProperties); |
|
| 77 | +$this->assertCount(1, $aProperties['saveFiles']); |
|
| 78 | +$this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']); |
|
| 79 | +} |
|
| 80 | 80 | |
| 81 | - /** |
|
| 81 | +/** |
|
| 82 | 82 | * @throws SetupException |
| 83 | 83 | */ |
| 84 | - public function testDatabagAnnotation() |
|
| 85 | - { |
|
| 86 | - $xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['withBags']); |
|
| 87 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 88 | - $aProperties = $xMetadata->getProperties(); |
|
| 89 | - |
|
| 90 | - $this->assertFalse($bExcluded); |
|
| 91 | - |
|
| 92 | - $this->assertCount(1, $aProperties); |
|
| 93 | - $this->assertArrayHasKey('withBags', $aProperties); |
|
| 94 | - $this->assertCount(1, $aProperties['withBags']); |
|
| 95 | - $this->assertCount(2, $aProperties['withBags']['bags']); |
|
| 96 | - $this->assertEquals('user.name', $aProperties['withBags']['bags'][0]); |
|
| 97 | - $this->assertEquals('page.number', $aProperties['withBags']['bags'][1]); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 84 | +public function testDatabagAnnotation() |
|
| 85 | +{ |
|
| 86 | +$xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['withBags']); |
|
| 87 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 88 | +$aProperties = $xMetadata->getProperties(); |
|
| 89 | + |
|
| 90 | +$this->assertFalse($bExcluded); |
|
| 91 | + |
|
| 92 | +$this->assertCount(1, $aProperties); |
|
| 93 | +$this->assertArrayHasKey('withBags', $aProperties); |
|
| 94 | +$this->assertCount(1, $aProperties['withBags']); |
|
| 95 | +$this->assertCount(2, $aProperties['withBags']['bags']); |
|
| 96 | +$this->assertEquals('user.name', $aProperties['withBags']['bags'][0]); |
|
| 97 | +$this->assertEquals('page.number', $aProperties['withBags']['bags'][1]); |
|
| 98 | +} |
|
| 99 | + |
|
| 100 | +/** |
|
| 101 | 101 | * @throws SetupException |
| 102 | 102 | */ |
| 103 | - public function testCallbackAnnotation() |
|
| 104 | - { |
|
| 105 | - $xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['withCallback']); |
|
| 106 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 107 | - $aProperties = $xMetadata->getProperties(); |
|
| 108 | - |
|
| 109 | - $this->assertFalse($bExcluded); |
|
| 110 | - |
|
| 111 | - $this->assertCount(1, $aProperties); |
|
| 112 | - $this->assertArrayHasKey('withCallback', $aProperties); |
|
| 113 | - $this->assertCount(1, $aProperties['withCallback']); |
|
| 114 | - $this->assertIsArray($aProperties['withCallback']['callback']); |
|
| 115 | - $this->assertEquals('jaxon.ajax.callback.test', $aProperties['withCallback']['callback'][0]); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** |
|
| 103 | +public function testCallbackAnnotation() |
|
| 104 | +{ |
|
| 105 | +$xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['withCallback']); |
|
| 106 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 107 | +$aProperties = $xMetadata->getProperties(); |
|
| 108 | + |
|
| 109 | +$this->assertFalse($bExcluded); |
|
| 110 | + |
|
| 111 | +$this->assertCount(1, $aProperties); |
|
| 112 | +$this->assertArrayHasKey('withCallback', $aProperties); |
|
| 113 | +$this->assertCount(1, $aProperties['withCallback']); |
|
| 114 | +$this->assertIsArray($aProperties['withCallback']['callback']); |
|
| 115 | +$this->assertEquals('jaxon.ajax.callback.test', $aProperties['withCallback']['callback'][0]); |
|
| 116 | +} |
|
| 117 | + |
|
| 118 | +/** |
|
| 119 | 119 | * @throws SetupException |
| 120 | 120 | */ |
| 121 | - public function testHooksAnnotation() |
|
| 122 | - { |
|
| 123 | - $xMetadata = $this->getAttributes(DocBlockAnnotated::class, |
|
| 124 | - ['cbSingle', 'cbMultiple', 'cbParams']); |
|
| 125 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 126 | - $aProperties = $xMetadata->getProperties(); |
|
| 127 | - |
|
| 128 | - $this->assertFalse($bExcluded); |
|
| 129 | - |
|
| 130 | - $this->assertCount(3, $aProperties); |
|
| 131 | - $this->assertArrayHasKey('cbSingle', $aProperties); |
|
| 132 | - $this->assertArrayHasKey('cbMultiple', $aProperties); |
|
| 133 | - $this->assertArrayHasKey('cbParams', $aProperties); |
|
| 134 | - |
|
| 135 | - $this->assertCount(1, $aProperties['cbSingle']['__before']); |
|
| 136 | - $this->assertCount(2, $aProperties['cbMultiple']['__before']); |
|
| 137 | - $this->assertCount(2, $aProperties['cbParams']['__before']); |
|
| 138 | - $this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']); |
|
| 139 | - $this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']); |
|
| 140 | - $this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']); |
|
| 141 | - $this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']); |
|
| 142 | - $this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']); |
|
| 143 | - $this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']); |
|
| 144 | - $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']); |
|
| 145 | - $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']); |
|
| 146 | - $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']); |
|
| 147 | - $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']); |
|
| 148 | - |
|
| 149 | - $this->assertCount(1, $aProperties['cbSingle']['__after']); |
|
| 150 | - $this->assertCount(3, $aProperties['cbMultiple']['__after']); |
|
| 151 | - $this->assertCount(1, $aProperties['cbParams']['__after']); |
|
| 152 | - $this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']); |
|
| 153 | - $this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']); |
|
| 154 | - $this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']); |
|
| 155 | - $this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']); |
|
| 156 | - $this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']); |
|
| 157 | - $this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']); |
|
| 158 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']); |
|
| 159 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']); |
|
| 160 | - $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']); |
|
| 161 | - $this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 121 | +public function testHooksAnnotation() |
|
| 122 | +{ |
|
| 123 | +$xMetadata = $this->getAttributes(DocBlockAnnotated::class, |
|
| 124 | +['cbSingle', 'cbMultiple', 'cbParams']); |
|
| 125 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 126 | +$aProperties = $xMetadata->getProperties(); |
|
| 127 | + |
|
| 128 | +$this->assertFalse($bExcluded); |
|
| 129 | + |
|
| 130 | +$this->assertCount(3, $aProperties); |
|
| 131 | +$this->assertArrayHasKey('cbSingle', $aProperties); |
|
| 132 | +$this->assertArrayHasKey('cbMultiple', $aProperties); |
|
| 133 | +$this->assertArrayHasKey('cbParams', $aProperties); |
|
| 134 | + |
|
| 135 | +$this->assertCount(1, $aProperties['cbSingle']['__before']); |
|
| 136 | +$this->assertCount(2, $aProperties['cbMultiple']['__before']); |
|
| 137 | +$this->assertCount(2, $aProperties['cbParams']['__before']); |
|
| 138 | +$this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']); |
|
| 139 | +$this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']); |
|
| 140 | +$this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']); |
|
| 141 | +$this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']); |
|
| 142 | +$this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']); |
|
| 143 | +$this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']); |
|
| 144 | +$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']); |
|
| 145 | +$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']); |
|
| 146 | +$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']); |
|
| 147 | +$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']); |
|
| 148 | + |
|
| 149 | +$this->assertCount(1, $aProperties['cbSingle']['__after']); |
|
| 150 | +$this->assertCount(3, $aProperties['cbMultiple']['__after']); |
|
| 151 | +$this->assertCount(1, $aProperties['cbParams']['__after']); |
|
| 152 | +$this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']); |
|
| 153 | +$this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']); |
|
| 154 | +$this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']); |
|
| 155 | +$this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']); |
|
| 156 | +$this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']); |
|
| 157 | +$this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']); |
|
| 158 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']); |
|
| 159 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']); |
|
| 160 | +$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']); |
|
| 161 | +$this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']); |
|
| 162 | +} |
|
| 163 | + |
|
| 164 | +/** |
|
| 165 | 165 | * @throws SetupException |
| 166 | 166 | */ |
| 167 | - public function testContainerAnnotation() |
|
| 168 | - { |
|
| 169 | - $xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['di1', 'di2']); |
|
| 170 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 171 | - $aProperties = $xMetadata->getProperties(); |
|
| 172 | - |
|
| 173 | - $this->assertFalse($bExcluded); |
|
| 174 | - |
|
| 175 | - $this->assertCount(2, $aProperties); |
|
| 176 | - $this->assertArrayHasKey('di1', $aProperties); |
|
| 177 | - $this->assertArrayHasKey('di2', $aProperties); |
|
| 178 | - $this->assertCount(2, $aProperties['di1']['__di']); |
|
| 179 | - $this->assertCount(2, $aProperties['di2']['__di']); |
|
| 180 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']); |
|
| 181 | - $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']); |
|
| 182 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']); |
|
| 183 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']); |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 167 | +public function testContainerAnnotation() |
|
| 168 | +{ |
|
| 169 | +$xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['di1', 'di2']); |
|
| 170 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 171 | +$aProperties = $xMetadata->getProperties(); |
|
| 172 | + |
|
| 173 | +$this->assertFalse($bExcluded); |
|
| 174 | + |
|
| 175 | +$this->assertCount(2, $aProperties); |
|
| 176 | +$this->assertArrayHasKey('di1', $aProperties); |
|
| 177 | +$this->assertArrayHasKey('di2', $aProperties); |
|
| 178 | +$this->assertCount(2, $aProperties['di1']['__di']); |
|
| 179 | +$this->assertCount(2, $aProperties['di2']['__di']); |
|
| 180 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']); |
|
| 181 | +$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']); |
|
| 182 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']); |
|
| 183 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']); |
|
| 184 | +} |
|
| 185 | + |
|
| 186 | +/** |
|
| 187 | 187 | * @throws SetupException |
| 188 | 188 | */ |
| 189 | - public function testClassAnnotation() |
|
| 190 | - { |
|
| 191 | - $xMetadata = $this->getAttributes(DocBlockClassAnnotated::class, []); |
|
| 192 | - // $this->assertEquals('', json_encode($aProperties)); |
|
| 193 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 194 | - $aProperties = $xMetadata->getProperties(); |
|
| 195 | - |
|
| 196 | - $this->assertFalse($bExcluded); |
|
| 197 | - |
|
| 198 | - $this->assertCount(1, $aProperties); |
|
| 199 | - $this->assertArrayHasKey('*', $aProperties); |
|
| 200 | - $this->assertCount(5, $aProperties['*']); |
|
| 201 | - $this->assertArrayHasKey('bags', $aProperties['*']); |
|
| 202 | - $this->assertArrayHasKey('callback', $aProperties['*']); |
|
| 203 | - $this->assertArrayHasKey('__before', $aProperties['*']); |
|
| 204 | - $this->assertArrayHasKey('__after', $aProperties['*']); |
|
| 205 | - |
|
| 206 | - $this->assertCount(2, $aProperties['*']['bags']); |
|
| 207 | - $this->assertEquals('user.name', $aProperties['*']['bags'][0]); |
|
| 208 | - $this->assertEquals('page.number', $aProperties['*']['bags'][1]); |
|
| 209 | - |
|
| 210 | - $this->assertIsArray($aProperties['*']['callback']); |
|
| 211 | - $this->assertEquals('jaxon.ajax.callback.test', $aProperties['*']['callback'][0]); |
|
| 212 | - |
|
| 213 | - $this->assertCount(2, $aProperties['*']['__before']); |
|
| 214 | - $this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']); |
|
| 215 | - $this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']); |
|
| 216 | - $this->assertIsArray($aProperties['*']['__before']['funcBefore1']); |
|
| 217 | - $this->assertIsArray($aProperties['*']['__before']['funcBefore2']); |
|
| 218 | - |
|
| 219 | - $this->assertCount(3, $aProperties['*']['__after']); |
|
| 220 | - $this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']); |
|
| 221 | - $this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']); |
|
| 222 | - $this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']); |
|
| 223 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter1']); |
|
| 224 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter2']); |
|
| 225 | - $this->assertIsArray($aProperties['*']['__after']['funcAfter3']); |
|
| 226 | - |
|
| 227 | - $this->assertCount(3, $aProperties['*']['__di']); |
|
| 228 | - $this->assertArrayHasKey('colorService', $aProperties['*']['__di']); |
|
| 229 | - $this->assertArrayHasKey('textService', $aProperties['*']['__di']); |
|
| 230 | - $this->assertArrayHasKey('fontService', $aProperties['*']['__di']); |
|
| 231 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']); |
|
| 232 | - $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']); |
|
| 233 | - $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 189 | +public function testClassAnnotation() |
|
| 190 | +{ |
|
| 191 | +$xMetadata = $this->getAttributes(DocBlockClassAnnotated::class, []); |
|
| 192 | +// $this->assertEquals('', json_encode($aProperties)); |
|
| 193 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 194 | +$aProperties = $xMetadata->getProperties(); |
|
| 195 | + |
|
| 196 | +$this->assertFalse($bExcluded); |
|
| 197 | + |
|
| 198 | +$this->assertCount(1, $aProperties); |
|
| 199 | +$this->assertArrayHasKey('*', $aProperties); |
|
| 200 | +$this->assertCount(5, $aProperties['*']); |
|
| 201 | +$this->assertArrayHasKey('bags', $aProperties['*']); |
|
| 202 | +$this->assertArrayHasKey('callback', $aProperties['*']); |
|
| 203 | +$this->assertArrayHasKey('__before', $aProperties['*']); |
|
| 204 | +$this->assertArrayHasKey('__after', $aProperties['*']); |
|
| 205 | + |
|
| 206 | +$this->assertCount(2, $aProperties['*']['bags']); |
|
| 207 | +$this->assertEquals('user.name', $aProperties['*']['bags'][0]); |
|
| 208 | +$this->assertEquals('page.number', $aProperties['*']['bags'][1]); |
|
| 209 | + |
|
| 210 | +$this->assertIsArray($aProperties['*']['callback']); |
|
| 211 | +$this->assertEquals('jaxon.ajax.callback.test', $aProperties['*']['callback'][0]); |
|
| 212 | + |
|
| 213 | +$this->assertCount(2, $aProperties['*']['__before']); |
|
| 214 | +$this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']); |
|
| 215 | +$this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']); |
|
| 216 | +$this->assertIsArray($aProperties['*']['__before']['funcBefore1']); |
|
| 217 | +$this->assertIsArray($aProperties['*']['__before']['funcBefore2']); |
|
| 218 | + |
|
| 219 | +$this->assertCount(3, $aProperties['*']['__after']); |
|
| 220 | +$this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']); |
|
| 221 | +$this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']); |
|
| 222 | +$this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']); |
|
| 223 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter1']); |
|
| 224 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter2']); |
|
| 225 | +$this->assertIsArray($aProperties['*']['__after']['funcAfter3']); |
|
| 226 | + |
|
| 227 | +$this->assertCount(3, $aProperties['*']['__di']); |
|
| 228 | +$this->assertArrayHasKey('colorService', $aProperties['*']['__di']); |
|
| 229 | +$this->assertArrayHasKey('textService', $aProperties['*']['__di']); |
|
| 230 | +$this->assertArrayHasKey('fontService', $aProperties['*']['__di']); |
|
| 231 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']); |
|
| 232 | +$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']); |
|
| 233 | +$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']); |
|
| 234 | +} |
|
| 235 | + |
|
| 236 | +/** |
|
| 237 | 237 | * @throws SetupException |
| 238 | 238 | */ |
| 239 | - public function testClassExcludeAnnotation() |
|
| 240 | - { |
|
| 241 | - $xMetadata = $this->getAttributes(DocBlockClassExcluded::class, |
|
| 242 | - ['doNot', 'withBags', 'cbSingle']); |
|
| 243 | - $bExcluded = $xMetadata->isExcluded(); |
|
| 244 | - $aProperties = $xMetadata->getProperties(); |
|
| 245 | - $aExcluded = $xMetadata->getExceptMethods(); |
|
| 246 | - |
|
| 247 | - $this->assertTrue($bExcluded); |
|
| 248 | - $this->assertEmpty($aProperties); |
|
| 249 | - $this->assertEmpty($aExcluded); |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - public function testUploadAnnotationErrorFieldName() |
|
| 253 | - { |
|
| 254 | - $this->expectException(SetupException::class); |
|
| 255 | - $this->getAttributes(DocBlockAnnotated::class, ['saveFileErrorFieldName']); |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - public function testUploadAnnotationErrorFieldNumber() |
|
| 259 | - { |
|
| 260 | - $this->expectException(SetupException::class); |
|
| 261 | - $this->getAttributes(DocBlockAnnotated::class, ['saveFileErrorFieldNumber']); |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - public function testDatabagAnnotationErrorName() |
|
| 265 | - { |
|
| 266 | - $this->expectException(SetupException::class); |
|
| 267 | - $this->getAttributes(DocBlockAnnotated::class, ['withBagsErrorName']); |
|
| 268 | - } |
|
| 269 | - |
|
| 270 | - public function testDatabagAnnotationErrorNumber() |
|
| 271 | - { |
|
| 272 | - $this->expectException(SetupException::class); |
|
| 273 | - $this->getAttributes(DocBlockAnnotated::class, ['withBagsErrorNumber']); |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - public function testContainerAnnotationErrorAttr() |
|
| 277 | - { |
|
| 278 | - $this->expectException(SetupException::class); |
|
| 279 | - $this->getAttributes(DocBlockAnnotated::class, ['diErrorAttr']); |
|
| 280 | - } |
|
| 281 | - |
|
| 282 | - public function testContainerAnnotationErrorClass() |
|
| 283 | - { |
|
| 284 | - $this->expectException(SetupException::class); |
|
| 285 | - $this->getAttributes(DocBlockAnnotated::class, ['diErrorClass']); |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - public function testContainerAnnotationErrorOneParam() |
|
| 289 | - { |
|
| 290 | - $this->expectException(SetupException::class); |
|
| 291 | - $this->getAttributes(DocBlockAnnotated::class, ['diErrorOneParam']); |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - public function testContainerAnnotationErrorThreeParams() |
|
| 295 | - { |
|
| 296 | - $this->expectException(SetupException::class); |
|
| 297 | - $this->getAttributes(DocBlockAnnotated::class, ['diErrorThreeParams']); |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - public function testCbBeforeAnnotationErrorName() |
|
| 301 | - { |
|
| 302 | - $this->expectException(SetupException::class); |
|
| 303 | - $this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorName']); |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - public function testCbBeforeAnnotationErrorParam() |
|
| 307 | - { |
|
| 308 | - $this->expectException(SetupException::class); |
|
| 309 | - $this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorParam']); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - public function testCbBeforeAnnotationErrorNumber() |
|
| 313 | - { |
|
| 314 | - $this->expectException(SetupException::class); |
|
| 315 | - $this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorNumber']); |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - public function testCbAfterAnnotationErrorName() |
|
| 319 | - { |
|
| 320 | - $this->expectException(SetupException::class); |
|
| 321 | - $this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorName']); |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - public function testCbAfterAnnotationErrorParam() |
|
| 325 | - { |
|
| 326 | - $this->expectException(SetupException::class); |
|
| 327 | - $this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorParam']); |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - public function testCbAfterAnnotationErrorNumber() |
|
| 331 | - { |
|
| 332 | - $this->expectException(SetupException::class); |
|
| 333 | - $this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorNumber']); |
|
| 334 | - } |
|
| 239 | +public function testClassExcludeAnnotation() |
|
| 240 | +{ |
|
| 241 | +$xMetadata = $this->getAttributes(DocBlockClassExcluded::class, |
|
| 242 | +['doNot', 'withBags', 'cbSingle']); |
|
| 243 | +$bExcluded = $xMetadata->isExcluded(); |
|
| 244 | +$aProperties = $xMetadata->getProperties(); |
|
| 245 | +$aExcluded = $xMetadata->getExceptMethods(); |
|
| 246 | + |
|
| 247 | +$this->assertTrue($bExcluded); |
|
| 248 | +$this->assertEmpty($aProperties); |
|
| 249 | +$this->assertEmpty($aExcluded); |
|
| 250 | +} |
|
| 251 | + |
|
| 252 | +public function testUploadAnnotationErrorFieldName() |
|
| 253 | +{ |
|
| 254 | +$this->expectException(SetupException::class); |
|
| 255 | +$this->getAttributes(DocBlockAnnotated::class, ['saveFileErrorFieldName']); |
|
| 256 | +} |
|
| 257 | + |
|
| 258 | +public function testUploadAnnotationErrorFieldNumber() |
|
| 259 | +{ |
|
| 260 | +$this->expectException(SetupException::class); |
|
| 261 | +$this->getAttributes(DocBlockAnnotated::class, ['saveFileErrorFieldNumber']); |
|
| 262 | +} |
|
| 263 | + |
|
| 264 | +public function testDatabagAnnotationErrorName() |
|
| 265 | +{ |
|
| 266 | +$this->expectException(SetupException::class); |
|
| 267 | +$this->getAttributes(DocBlockAnnotated::class, ['withBagsErrorName']); |
|
| 268 | +} |
|
| 269 | + |
|
| 270 | +public function testDatabagAnnotationErrorNumber() |
|
| 271 | +{ |
|
| 272 | +$this->expectException(SetupException::class); |
|
| 273 | +$this->getAttributes(DocBlockAnnotated::class, ['withBagsErrorNumber']); |
|
| 274 | +} |
|
| 275 | + |
|
| 276 | +public function testContainerAnnotationErrorAttr() |
|
| 277 | +{ |
|
| 278 | +$this->expectException(SetupException::class); |
|
| 279 | +$this->getAttributes(DocBlockAnnotated::class, ['diErrorAttr']); |
|
| 280 | +} |
|
| 281 | + |
|
| 282 | +public function testContainerAnnotationErrorClass() |
|
| 283 | +{ |
|
| 284 | +$this->expectException(SetupException::class); |
|
| 285 | +$this->getAttributes(DocBlockAnnotated::class, ['diErrorClass']); |
|
| 286 | +} |
|
| 287 | + |
|
| 288 | +public function testContainerAnnotationErrorOneParam() |
|
| 289 | +{ |
|
| 290 | +$this->expectException(SetupException::class); |
|
| 291 | +$this->getAttributes(DocBlockAnnotated::class, ['diErrorOneParam']); |
|
| 292 | +} |
|
| 293 | + |
|
| 294 | +public function testContainerAnnotationErrorThreeParams() |
|
| 295 | +{ |
|
| 296 | +$this->expectException(SetupException::class); |
|
| 297 | +$this->getAttributes(DocBlockAnnotated::class, ['diErrorThreeParams']); |
|
| 298 | +} |
|
| 299 | + |
|
| 300 | +public function testCbBeforeAnnotationErrorName() |
|
| 301 | +{ |
|
| 302 | +$this->expectException(SetupException::class); |
|
| 303 | +$this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorName']); |
|
| 304 | +} |
|
| 305 | + |
|
| 306 | +public function testCbBeforeAnnotationErrorParam() |
|
| 307 | +{ |
|
| 308 | +$this->expectException(SetupException::class); |
|
| 309 | +$this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorParam']); |
|
| 310 | +} |
|
| 311 | + |
|
| 312 | +public function testCbBeforeAnnotationErrorNumber() |
|
| 313 | +{ |
|
| 314 | +$this->expectException(SetupException::class); |
|
| 315 | +$this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorNumber']); |
|
| 316 | +} |
|
| 317 | + |
|
| 318 | +public function testCbAfterAnnotationErrorName() |
|
| 319 | +{ |
|
| 320 | +$this->expectException(SetupException::class); |
|
| 321 | +$this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorName']); |
|
| 322 | +} |
|
| 323 | + |
|
| 324 | +public function testCbAfterAnnotationErrorParam() |
|
| 325 | +{ |
|
| 326 | +$this->expectException(SetupException::class); |
|
| 327 | +$this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorParam']); |
|
| 328 | +} |
|
| 329 | + |
|
| 330 | +public function testCbAfterAnnotationErrorNumber() |
|
| 331 | +{ |
|
| 332 | +$this->expectException(SetupException::class); |
|
| 333 | +$this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorNumber']); |
|
| 334 | +} |
|
| 335 | 335 | } |
@@ -5,11 +5,11 @@ |
||
| 5 | 5 | |
| 6 | 6 | trait NodeTrait |
| 7 | 7 | { |
| 8 | - /** |
|
| 8 | +/** |
|
| 9 | 9 | * @return string |
| 10 | 10 | */ |
| 11 | - public function html(): string |
|
| 12 | - { |
|
| 13 | - return ''; |
|
| 14 | - } |
|
| 11 | +public function html(): string |
|
| 12 | +{ |
|
| 13 | +return ''; |
|
| 14 | +} |
|
| 15 | 15 | } |
@@ -7,27 +7,27 @@ |
||
| 7 | 7 | |
| 8 | 8 | class PageComponent extends BaseComponent |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * @return int |
| 12 | 12 | */ |
| 13 | - protected function count(): int |
|
| 14 | - { |
|
| 15 | - return 0; |
|
| 16 | - } |
|
| 13 | +protected function count(): int |
|
| 14 | +{ |
|
| 15 | +return 0; |
|
| 16 | +} |
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | +/** |
|
| 19 | 19 | * @return int |
| 20 | 20 | */ |
| 21 | - protected function limit(): int |
|
| 22 | - { |
|
| 23 | - return 0; |
|
| 24 | - } |
|
| 21 | +protected function limit(): int |
|
| 22 | +{ |
|
| 23 | +return 0; |
|
| 24 | +} |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * @return string |
| 28 | 28 | */ |
| 29 | - public function html(): string |
|
| 30 | - { |
|
| 31 | - return ''; |
|
| 32 | - } |
|
| 29 | +public function html(): string |
|
| 30 | +{ |
|
| 31 | +return ''; |
|
| 32 | +} |
|
| 33 | 33 | } |
@@ -7,5 +7,5 @@ |
||
| 7 | 7 | |
| 8 | 8 | class NodeComponent extends BaseComponent |
| 9 | 9 | { |
| 10 | - use Traits\NodeTrait; |
|
| 10 | +use Traits\NodeTrait; |
|
| 11 | 11 | } |