Passed
Push — main ( 7f530d...7aae9b )
by Thierry
05:54
created
jaxon-core/src/Plugin/Request/CallableClass/ComponentOptions.php 1 patch
Spacing   +22 added lines, -25 removed lines patch added patch discarded remove patch
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
         $sSeparator = $aOptions['separator'] ?? '.';
107 107
         $this->sSeparator = $sSeparator === '_' ? '_' : '.';
108 108
         $this->addProtectedMethods($aOptions['protected'] ?? []);
109
-        foreach($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
109
+        foreach ($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
110 110
         {
111 111
             // Names are in a comma-separated list.
112 112
             $aFunctionNames = explode(',', $sNames);
113
-            foreach($aFunctionNames as $sFunctionName)
113
+            foreach ($aFunctionNames as $sFunctionName)
114 114
             {
115 115
                 $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
116 116
             }
117 117
         }
118 118
 
119 119
         // Options from the attributes or annotations.
120
-        if($xMetadata !== null)
120
+        if ($xMetadata !== null)
121 121
         {
122 122
             $this->readMetadataOptions($xMetadata);
123 123
         }
@@ -133,8 +133,7 @@  discard block
 block discarded – undo
133 133
     private function addProtectedMethods(array|string $xMethods): void
134 134
     {
135 135
         $this->aExportMethods['except'] = array_merge($this->aExportMethods['except'],
136
-            !is_array($xMethods) ? [trim((string)$xMethods)] :
137
-            array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
136
+            !is_array($xMethods) ? [trim((string)$xMethods)] : array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
138 137
     }
139 138
 
140 139
     /**
@@ -149,7 +148,7 @@  discard block
 block discarded – undo
149 148
         $aExportMethods['except'] = array_unique(array_merge(
150 149
             $aExportMethods['except'] ?? [], $this->aExportMethods['except']));
151 150
         $this->aExportMethods = $aExportMethods;
152
-        foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
151
+        foreach ($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
153 152
         {
154 153
             $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
155 154
         }
@@ -162,7 +161,7 @@  discard block
 block discarded – undo
162 161
      */
163 162
     private function filterPublicMethods(array $aMethods): array
164 163
     {
165
-        if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
164
+        if ($this->bExcluded || in_array('*', $this->aExportMethods['except']))
166 165
         {
167 166
             return [];
168 167
         }
@@ -170,12 +169,12 @@  discard block
 block discarded – undo
170 169
         $aBaseMethods = $aMethods[1];
171 170
         $aNoMethods = $aMethods[2];
172 171
         $aMethods = $aMethods[0];
173
-        if(isset($this->aExportMethods['only']))
172
+        if (isset($this->aExportMethods['only']))
174 173
         {
175 174
             $aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
176 175
         }
177 176
         $aMethods = array_diff($aMethods, $this->aExportMethods['except']);
178
-        if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
177
+        if (count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
179 178
         {
180 179
             $aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
181 180
         }
@@ -261,19 +260,19 @@  discard block
 block discarded – undo
261 260
      */
262 261
     private function setHookMethods(array &$aHookMethods, $xValue): void
263 262
     {
264
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
263
+        foreach ($xValue as $sCalledMethod => $xMethodToCall)
265 264
         {
266
-            if(!isset($aHookMethods[$sCalledMethod]))
265
+            if (!isset($aHookMethods[$sCalledMethod]))
267 266
             {
268 267
                 $aHookMethods[$sCalledMethod] = [];
269 268
             }
270
-            if(is_array($xMethodToCall))
269
+            if (is_array($xMethodToCall))
271 270
             {
272 271
                 $aHookMethods[$sCalledMethod] =
273 272
                     array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
274 273
                 continue;
275 274
             }
276
-            if(is_string($xMethodToCall))
275
+            if (is_string($xMethodToCall))
277 276
             {
278 277
                 $aHookMethods[$sCalledMethod][] = $xMethodToCall;
279 278
             }
@@ -298,7 +297,7 @@  discard block
 block discarded – undo
298 297
      */
299 298
     private function addOption(string $sName, $xValue): void
300 299
     {
301
-        switch($sName)
300
+        switch ($sName)
302 301
         {
303 302
         // Set the methods to call before processing the request
304 303
         case '__before':
@@ -326,11 +325,11 @@  discard block
 block discarded – undo
326 325
      */
327 326
     private function _addJsArrayOption(string $sFunctionName, string $sOptionName, $xOptionValue): void
328 327
     {
329
-        if(is_string($xOptionValue))
328
+        if (is_string($xOptionValue))
330 329
         {
331 330
             $xOptionValue = [$xOptionValue];
332 331
         }
333
-        if(!is_array($xOptionValue))
332
+        if (!is_array($xOptionValue))
334 333
         {
335 334
             return; // Do not save.
336 335
         }
@@ -360,10 +359,10 @@  discard block
 block discarded – undo
360 359
      */
361 360
     private function addJsOption(string $sFunctionName, string $sOptionName, $xOptionValue): void
362 361
     {
363
-        switch($sOptionName)
362
+        switch ($sOptionName)
364 363
         {
365 364
         case 'excluded':
366
-            if((bool)$xOptionValue)
365
+            if ((bool)$xOptionValue)
367 366
             {
368 367
                 $this->addProtectedMethods($sFunctionName);
369 368
             }
@@ -387,12 +386,11 @@  discard block
 block discarded – undo
387 386
      */
388 387
     private function addFunctionOptions(string $sFunctionName, array $aFunctionOptions): void
389 388
     {
390
-        foreach($aFunctionOptions as $sOptionName => $xOptionValue)
389
+        foreach ($aFunctionOptions as $sOptionName => $xOptionValue)
391 390
         {
392 391
             substr($sOptionName, 0, 2) === '__' ?
393 392
                 // Options for PHP classes. They start with "__".
394
-                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) :
395
-                // Options for javascript code.
393
+                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : // Options for javascript code.
396 394
                 $this->addJsOption($sFunctionName, $sOptionName, $xOptionValue);
397 395
         }
398 396
     }
@@ -408,16 +406,15 @@  discard block
 block discarded – undo
408 406
         $aOptions = array_merge($this->aJsOptions['*'] ?? []); // Clone the array
409 407
         // Then add the method options.
410 408
         $aMethodOptions = $this->aJsOptions[$sMethodName] ?? [];
411
-        foreach($aMethodOptions as $sOptionName => $xOptionValue)
409
+        foreach ($aMethodOptions as $sOptionName => $xOptionValue)
412 410
         {
413 411
             // For databags and callbacks, merge the values in a single array.
414 412
             // For all the other options, keep the last value.
415 413
             $aOptions[$sOptionName] = !in_array($sOptionName, ['bags', 'callback']) ?
416
-                $xOptionValue :
417
-                array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
414
+                $xOptionValue : array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
418 415
         }
419 416
         // Since callbacks are js object names, they need a special formatting.
420
-        if(isset($aOptions['callback']))
417
+        if (isset($aOptions['callback']))
421 418
         {
422 419
             $aOptions['callback'] = str_replace('"', '', json_encode($aOptions['callback']));
423 420
         }
Please login to merge, or discard this patch.
jaxon-attributes/src/Attribute/Inject.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
 use function ltrim;
23 23
 
24
-#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY |
25
-    Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
24
+#[Attribute(Attribute::TARGET_CLASS|Attribute::TARGET_PROPERTY|
25
+    Attribute::TARGET_METHOD|Attribute::IS_REPEATABLE)]
26 26
 class Inject extends AbstractAttribute
27 27
 {
28 28
     /**
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function validate(): void
80 80
     {
81
-        if($this->nTarget === Attribute::TARGET_CLASS)
81
+        if ($this->nTarget === Attribute::TARGET_CLASS)
82 82
         {
83
-            if(!$this->attr || !$this->type)
83
+            if (!$this->attr || !$this->type)
84 84
             {
85 85
                 throw new SetupException('When applied to a class, the Inject attribute requires two arguments.');
86 86
             }
87 87
             return;
88 88
         }
89
-        if($this->nTarget === Attribute::TARGET_METHOD)
89
+        if ($this->nTarget === Attribute::TARGET_METHOD)
90 90
         {
91
-            if(!$this->attr)
91
+            if (!$this->attr)
92 92
             {
93 93
                 throw new SetupException('When applied to a method, the Inject attribute requires the "attr" argument.');
94 94
             }
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
      */
101 101
     private function getFullClassName(): void
102 102
     {
103
-        if(!$this->type)
103
+        if (!$this->type)
104 104
         {
105 105
             // If no type is provided, take the attribute type.
106 106
             $this->type = $this->aTypes[$this->attr] ?? '';
107 107
             return;
108 108
         }
109
-        if($this->type[0] === '\\')
109
+        if ($this->type[0] === '\\')
110 110
         {
111 111
             $this->type = ltrim($this->type, '\\');
112 112
         }
Please login to merge, or discard this patch.
jaxon-attributes/src/AttributeReader.php 1 patch
Spacing   +19 added lines, -21 removed lines patch added patch discarded remove patch
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
     private function readTypes(ReflectionClass $xClass)
83 83
     {
84 84
         $sClass = $xClass->getName();
85
-        if(isset($this->aTypes[$sClass]))
85
+        if (isset($this->aTypes[$sClass]))
86 86
         {
87 87
             return;
88 88
         }
89 89
 
90 90
         $this->aTypes[$sClass] = [];
91
-        $aProperties = $xClass->getProperties(ReflectionProperty::IS_PUBLIC |
91
+        $aProperties = $xClass->getProperties(ReflectionProperty::IS_PUBLIC|
92 92
             ReflectionProperty::IS_PROTECTED);
93
-        foreach($aProperties as $xReflectionProperty)
93
+        foreach ($aProperties as $xReflectionProperty)
94 94
         {
95 95
             $xType = $xReflectionProperty->getType();
96 96
             // Check that the property has a valid type defined
97
-            if(is_a($xType, ReflectionNamedType::class) &&
97
+            if (is_a($xType, ReflectionNamedType::class) &&
98 98
                 ($sType = $xType->getName()) !== '')
99 99
             {
100 100
                 $this->aTypes[$sClass][$xReflectionProperty->getName()] = $sType;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     private function initAttribute(AbstractAttribute $xAttribute,
113 113
         ReflectionClass $xClass, ReflectionAttribute $xReflectionAttribute): void
114 114
     {
115
-        if(is_a($xAttribute, InjectAttribute::class))
115
+        if (is_a($xAttribute, InjectAttribute::class))
116 116
         {
117 117
             $this->readTypes($xClass);
118 118
             $xAttribute->setTarget($xReflectionAttribute->getTarget());
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $aAttributes = $xClass->getAttributes();
161 161
         $aAttributes = array_filter($aAttributes, fn($xReflectionAttribute) =>
162 162
             $this->isBaseClassAttribute($xReflectionAttribute));
163
-        foreach($aAttributes as $xReflectionAttribute)
163
+        foreach ($aAttributes as $xReflectionAttribute)
164 164
         {
165 165
             $xReflectionAttribute->newInstance()->saveValue($this->xMetadata);
166 166
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $aAttributes = array_filter($aAttributes, fn($xReflectionAttribute) =>
178 178
             $this->isJaxonAttribute($xReflectionAttribute) &&
179 179
             !$this->isBaseClassAttribute($xReflectionAttribute));
180
-        foreach($aAttributes as $xReflectionAttribute)
180
+        foreach ($aAttributes as $xReflectionAttribute)
181 181
         {
182 182
             $xAttribute = $xReflectionAttribute->newInstance();
183 183
             $this->initAttribute($xAttribute, $xClass, $xReflectionAttribute);
@@ -195,17 +195,16 @@  discard block
 block discarded – undo
195 195
      */
196 196
     private function readPropertyAttributes(ReflectionClass $xClass, string $sProperty): void
197 197
     {
198
-        $aAttributes = !$xClass->hasProperty($sProperty) ? [] :
199
-            $xClass->getProperty($sProperty)->getAttributes();
198
+        $aAttributes = !$xClass->hasProperty($sProperty) ? [] : $xClass->getProperty($sProperty)->getAttributes();
200 199
         $aAttributes = array_filter($aAttributes, fn($xReflectionAttribute) =>
201 200
             $this->isPropertyAttribute($xReflectionAttribute));
202 201
         // Only Inject attributes are allowed on properties
203
-        if(count($aAttributes) > 1)
202
+        if (count($aAttributes) > 1)
204 203
         {
205 204
             throw new SetupException('Only one Inject attribute is allowed on a property');
206 205
         }
207 206
 
208
-        foreach($aAttributes as $xReflectionAttribute)
207
+        foreach ($aAttributes as $xReflectionAttribute)
209 208
         {
210 209
             /** @var InjectAttribute */
211 210
             $xAttribute = $xReflectionAttribute->newInstance();
@@ -224,11 +223,10 @@  discard block
 block discarded – undo
224 223
      */
225 224
     private function readMethodAttributes(ReflectionClass $xClass, string $sMethod): void
226 225
     {
227
-        $aAttributes = !$xClass->hasMethod($sMethod) ? [] :
228
-            $xClass->getMethod($sMethod)->getAttributes();
226
+        $aAttributes = !$xClass->hasMethod($sMethod) ? [] : $xClass->getMethod($sMethod)->getAttributes();
229 227
         $aAttributes = array_filter($aAttributes, fn($xReflectionAttribute) =>
230 228
             $this->isJaxonAttribute($xReflectionAttribute));
231
-        foreach($aAttributes as $xReflectionAttribute)
229
+        foreach ($aAttributes as $xReflectionAttribute)
232 230
         {
233 231
             $xAttribute = $xReflectionAttribute->newInstance();
234 232
             $this->initAttribute($xAttribute, $xClass, $xReflectionAttribute);
@@ -263,33 +261,33 @@  discard block
 block discarded – undo
263 261
             $this->readBaseClassAttributes($xClass);
264 262
 
265 263
             $aClasses = [$xClass];
266
-            while(($xClass = $this->getParentClass($xClass)) !== null)
264
+            while (($xClass = $this->getParentClass($xClass)) !== null)
267 265
             {
268 266
                 $aClasses[] = $xClass;
269 267
             }
270 268
             $aClasses = array_reverse($aClasses);
271 269
 
272
-            foreach($aClasses as $xClass)
270
+            foreach ($aClasses as $xClass)
273 271
             {
274 272
                 // Processing class attributes
275 273
                 $this->readClassAttributes($xClass);
276 274
                 // Processing properties attributes
277
-                foreach($xInput->getProperties() as $sProperty)
275
+                foreach ($xInput->getProperties() as $sProperty)
278 276
                 {
279 277
                     $this->readPropertyAttributes($xClass, $sProperty);
280 278
                 }
281 279
             }
282 280
 
283 281
             // The methods attributes are not taken for excluded classes.
284
-            if($this->xMetadata->isExcluded())
282
+            if ($this->xMetadata->isExcluded())
285 283
             {
286 284
                 return $this->xMetadata;
287 285
             }
288 286
 
289
-            foreach($aClasses as $xClass)
287
+            foreach ($aClasses as $xClass)
290 288
             {
291 289
                 // Processing methods attributes
292
-                foreach($xInput->getMethods() as $sMethod)
290
+                foreach ($xInput->getMethods() as $sMethod)
293 291
                 {
294 292
                     $this->readMethodAttributes($xClass, $sMethod);
295 293
                 }
@@ -297,7 +295,7 @@  discard block
 block discarded – undo
297 295
 
298 296
             return $this->xMetadata;
299 297
         }
300
-        catch(Exception|Error $e)
298
+        catch (Exception|Error $e)
301 299
         {
302 300
             throw new SetupException($e->getMessage());
303 301
         }
Please login to merge, or discard this patch.
jaxon-annotations/src/AnnotationReader.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
             fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class)
117 117
         );
118 118
         // First check if the class is excluded.
119
-        foreach($aAnnotations as $xAnnotation)
119
+        foreach ($aAnnotations as $xAnnotation)
120 120
         {
121
-            if(is_a($xAnnotation, ExcludeAnnotation::class))
121
+            if (is_a($xAnnotation, ExcludeAnnotation::class))
122 122
             {
123 123
                 $xAnnotation->saveValue($this->xMetadata);
124 124
             }
125 125
         }
126
-        if($this->xMetadata->isExcluded())
126
+        if ($this->xMetadata->isExcluded())
127 127
         {
128 128
             return;
129 129
         }
130 130
 
131
-        foreach($aAnnotations as $xAnnotation)
131
+        foreach ($aAnnotations as $xAnnotation)
132 132
         {
133
-            if(!is_a($xAnnotation, ExcludeAnnotation::class))
133
+            if (!is_a($xAnnotation, ExcludeAnnotation::class))
134 134
             {
135 135
                 $xAnnotation->saveValue($this->xMetadata);
136 136
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             $this->xManager->getPropertyAnnotations($sClass, $sProperty),
153 153
             function($xAnnotation) use($sProperty) {
154 154
                 // Save the property type
155
-                if(is_a($xAnnotation, VarAnnotation::class))
155
+                if (is_a($xAnnotation, VarAnnotation::class))
156 156
                 {
157 157
                     $this->aPropTypes[$sProperty] = $xAnnotation->type;
158 158
                 }
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
                 return is_a($xAnnotation, ContainerAnnotation::class);
161 161
             }
162 162
         );
163
-        if(count($aAnnotations) > 1)
163
+        if (count($aAnnotations) > 1)
164 164
         {
165 165
             throw new AnnotationException('Only one @di annotation is allowed on a property');
166 166
         }
167 167
 
168
-        foreach($aAnnotations as $xAnnotation)
168
+        foreach ($aAnnotations as $xAnnotation)
169 169
         {
170 170
             $xAnnotation->setAttr($sProperty);
171 171
             $xAnnotation->saveValue($this->xMetadata);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             $this->xManager->getMethodAnnotations($sClass, $sMethod),
188 188
             fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class)
189 189
         );
190
-        foreach($aAnnotations as $xAnnotation)
190
+        foreach ($aAnnotations as $xAnnotation)
191 191
         {
192 192
             $xAnnotation->saveValue($this->xMetadata, $sMethod);
193 193
         }
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
             $this->sCurrMemberType = AnnotationManager::MEMBER_PROPERTY;
215 215
 
216 216
             // Properties annotations
217
-            foreach($xInput->getProperties() as $sProperty)
217
+            foreach ($xInput->getProperties() as $sProperty)
218 218
             {
219 219
                 $this->readPropertyAnnotations($sClass, $sProperty);
220 220
             }
221 221
 
222 222
             // The methods annotations are not taken for excluded classes.
223
-            if($this->xMetadata->isExcluded())
223
+            if ($this->xMetadata->isExcluded())
224 224
             {
225 225
                 return $this->xMetadata;
226 226
             }
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
             // Processing methods annotations
229 229
             $this->sCurrMemberType = AnnotationManager::MEMBER_METHOD;
230 230
 
231
-            foreach($xInput->getMethods() as $sMethod)
231
+            foreach ($xInput->getMethods() as $sMethod)
232 232
             {
233 233
                 $this->readMethodAnnotations($sClass, $sMethod);
234 234
             }
235 235
 
236 236
             return $this->xMetadata;
237 237
         }
238
-        catch(AnnotationException $e)
238
+        catch (AnnotationException $e)
239 239
         {
240 240
             throw new SetupException($e->getMessage());
241 241
         }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/TraitAnnotationTest.php 1 patch
Switch Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -12,89 +12,89 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/ExtendAnnotationTest.php 1 patch
Switch Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -14,346 +14,346 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/AnnotationTest.php 1 patch
Switch Indentation   +337 added lines, -337 removed lines patch added patch discarded remove patch
@@ -16,382 +16,382 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/ComponentTest.php 1 patch
Switch Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -16,133 +16,133 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/AttrAnnotationTest.php 1 patch
Switch Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -12,186 +12,186 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.