@@ -6,26 +6,26 @@ |
||
| 6 | 6 | |
| 7 | 7 | trait HelperTrait |
| 8 | 8 | { |
| 9 | - /** |
|
| 9 | +/** |
|
| 10 | 10 | * @var ComponentHelper |
| 11 | 11 | */ |
| 12 | - private $xHelper; |
|
| 12 | +private $xHelper; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * @param ComponentHelper $xHelper |
| 16 | 16 | * |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | - private function setHelper(ComponentHelper $xHelper): void |
|
| 20 | - { |
|
| 21 | - $this->xHelper = $xHelper; |
|
| 22 | - } |
|
| 19 | +private function setHelper(ComponentHelper $xHelper): void |
|
| 20 | +{ |
|
| 21 | +$this->xHelper = $xHelper; |
|
| 22 | +} |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @return ComponentHelper |
| 26 | 26 | */ |
| 27 | - protected function helper(): ComponentHelper |
|
| 28 | - { |
|
| 29 | - return $this->xHelper; |
|
| 30 | - } |
|
| 27 | +protected function helper(): ComponentHelper |
|
| 28 | +{ |
|
| 29 | +return $this->xHelper; |
|
| 30 | +} |
|
| 31 | 31 | } |
@@ -7,49 +7,49 @@ |
||
| 7 | 7 | |
| 8 | 8 | trait NodeResponseTrait |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * @var NodeResponse |
| 12 | 12 | */ |
| 13 | - protected $nodeResponse = null; |
|
| 13 | +protected $nodeResponse = null; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 15 | +/** |
|
| 16 | 16 | * @var string |
| 17 | 17 | */ |
| 18 | - protected $overrides = ''; |
|
| 18 | +protected $overrides = ''; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 20 | +/** |
|
| 21 | 21 | * @param Container $di |
| 22 | 22 | * |
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | - private function setNodeResponse(Container $di): void |
|
| 26 | - { |
|
| 27 | - // Each component must have its own reponse object. |
|
| 28 | - // A component can override another one. In this case, |
|
| 29 | - // its response is attached to the overriden component DOM node. |
|
| 30 | - $this->nodeResponse = $di->newNodeResponse($this->rq($this->overrides ?: '')); |
|
| 31 | - } |
|
| 25 | +private function setNodeResponse(Container $di): void |
|
| 26 | +{ |
|
| 27 | +// Each component must have its own reponse object. |
|
| 28 | +// A component can override another one. In this case, |
|
| 29 | +// its response is attached to the overriden component DOM node. |
|
| 30 | +$this->nodeResponse = $di->newNodeResponse($this->rq($this->overrides ?: '')); |
|
| 31 | +} |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * Get the component response |
| 35 | 35 | * |
| 36 | 36 | * @return NodeResponse |
| 37 | 37 | */ |
| 38 | - final protected function node(): NodeResponse |
|
| 39 | - { |
|
| 40 | - return $this->nodeResponse; |
|
| 41 | - } |
|
| 38 | +final protected function node(): NodeResponse |
|
| 39 | +{ |
|
| 40 | +return $this->nodeResponse; |
|
| 41 | +} |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * Set the component item. |
| 45 | 45 | * |
| 46 | 46 | * @param string $item |
| 47 | 47 | * |
| 48 | 48 | * @return self |
| 49 | 49 | */ |
| 50 | - final public function item(string $item): self |
|
| 51 | - { |
|
| 52 | - $this->node()->item($item); |
|
| 53 | - return $this; |
|
| 54 | - } |
|
| 50 | +final public function item(string $item): self |
|
| 51 | +{ |
|
| 52 | +$this->node()->item($item); |
|
| 53 | +return $this; |
|
| 54 | +} |
|
| 55 | 55 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | protected function validateName(string $sName): void |
| 52 | 52 | { |
| 53 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 53 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 54 | 54 | { |
| 55 | 55 | return; |
| 56 | 56 | } |
@@ -22,61 +22,61 @@ |
||
| 22 | 22 | |
| 23 | 23 | class DatabagData extends AbstractData |
| 24 | 24 | { |
| 25 | - /** |
|
| 25 | +/** |
|
| 26 | 26 | * The databag names |
| 27 | 27 | * |
| 28 | 28 | * @var array |
| 29 | 29 | */ |
| 30 | - protected $aNames = []; |
|
| 30 | +protected $aNames = []; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | +/** |
|
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function getName(): string |
|
| 36 | - { |
|
| 37 | - return 'bags'; |
|
| 38 | - } |
|
| 35 | +public function getName(): string |
|
| 36 | +{ |
|
| 37 | +return 'bags'; |
|
| 38 | +} |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function getValue(): mixed |
|
| 44 | - { |
|
| 45 | - return array_values($this->aNames); |
|
| 46 | - } |
|
| 43 | +public function getValue(): mixed |
|
| 44 | +{ |
|
| 45 | +return array_values($this->aNames); |
|
| 46 | +} |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * @param string $sName |
| 50 | 50 | * |
| 51 | 51 | * @return void |
| 52 | 52 | */ |
| 53 | - protected function validateName(string $sName): void |
|
| 54 | - { |
|
| 55 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 56 | - { |
|
| 57 | - return; |
|
| 58 | - } |
|
| 59 | - throw new SetupException("$sName is not a valid \"name\" value for databag"); |
|
| 60 | - } |
|
| 53 | +protected function validateName(string $sName): void |
|
| 54 | +{ |
|
| 55 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 56 | +{ |
|
| 57 | +return; |
|
| 58 | +} |
|
| 59 | +throw new SetupException("$sName is not a valid \"name\" value for databag"); |
|
| 60 | +} |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * @param string $sName |
| 64 | 64 | * |
| 65 | 65 | * @return void |
| 66 | 66 | */ |
| 67 | - public function addValue(string $sName): void |
|
| 68 | - { |
|
| 69 | - $this->validateName($sName); |
|
| 67 | +public function addValue(string $sName): void |
|
| 68 | +{ |
|
| 69 | +$this->validateName($sName); |
|
| 70 | 70 | |
| 71 | - $this->aNames[$sName] = $sName; |
|
| 72 | - } |
|
| 71 | +$this->aNames[$sName] = $sName; |
|
| 72 | +} |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | +/** |
|
| 75 | 75 | * @inheritDoc |
| 76 | 76 | */ |
| 77 | - public function encode(string $sVarName): array |
|
| 78 | - { |
|
| 79 | - return array_map(fn($sName) => |
|
| 80 | - "{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 81 | - } |
|
| 77 | +public function encode(string $sVarName): array |
|
| 78 | +{ |
|
| 79 | +return array_map(fn($sName) => |
|
| 80 | +"{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 81 | +} |
|
| 82 | 82 | } |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | |
| 17 | 17 | class AfterData extends HookData |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @inheritDoc |
| 21 | 21 | */ |
| 22 | - protected function getType(): string |
|
| 23 | - { |
|
| 24 | - return 'after'; |
|
| 25 | - } |
|
| 22 | +protected function getType(): string |
|
| 23 | +{ |
|
| 24 | +return 'after'; |
|
| 25 | +} |
|
| 26 | 26 | } |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | |
| 17 | 17 | class BeforeData extends HookData |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @inheritDoc |
| 21 | 21 | */ |
| 22 | - protected function getType(): string |
|
| 23 | - { |
|
| 24 | - return 'before'; |
|
| 25 | - } |
|
| 22 | +protected function getType(): string |
|
| 23 | +{ |
|
| 24 | +return 'before'; |
|
| 25 | +} |
|
| 26 | 26 | } |
@@ -30,16 +30,16 @@ |
||
| 30 | 30 | |
| 31 | 31 | abstract class AbstractRequestPlugin extends AbstractPlugin implements CallableRegistryInterface, RequestHandlerInterface |
| 32 | 32 | { |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * @var Target |
| 35 | 35 | */ |
| 36 | - protected $xTarget = null; |
|
| 36 | +protected $xTarget = null; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * @inheritDoc |
| 40 | 40 | */ |
| 41 | - public function getTarget(): ?Target |
|
| 42 | - { |
|
| 43 | - return $this->xTarget; |
|
| 44 | - } |
|
| 41 | +public function getTarget(): ?Target |
|
| 42 | +{ |
|
| 43 | +return $this->xTarget; |
|
| 44 | +} |
|
| 45 | 45 | } |
@@ -7,21 +7,21 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | interface RequestHandlerInterface |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * Get the target function or class and method |
| 12 | 12 | * |
| 13 | 13 | * @return Target|null |
| 14 | 14 | */ |
| 15 | - public function getTarget(): ?Target; |
|
| 15 | +public function getTarget(): ?Target; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * @param ServerRequestInterface $xRequest |
| 19 | 19 | * |
| 20 | 20 | * @return Target |
| 21 | 21 | */ |
| 22 | - public function setTarget(ServerRequestInterface $xRequest): Target; |
|
| 22 | +public function setTarget(ServerRequestInterface $xRequest): Target; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * Check if this plugin can process the current request |
| 26 | 26 | * |
| 27 | 27 | * Called by the <Jaxon\Plugin\RequestManager> when a request has been received to determine |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return bool |
| 33 | 33 | */ |
| 34 | - public static function canProcessRequest(ServerRequestInterface $xRequest): bool; |
|
| 34 | +public static function canProcessRequest(ServerRequestInterface $xRequest): bool; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * Process the current request |
| 38 | 38 | * |
| 39 | 39 | * Called by the <Jaxon\Plugin\RequestManager> when a request is being processed. |
@@ -42,5 +42,5 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | - public function processRequest(): void; |
|
| 45 | +public function processRequest(): void; |
|
| 46 | 46 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -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 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -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 | } |