Passed
Push — main ( 10601e...ca0571 )
by Thierry
04:19
created
jaxon-core/src/Request/Handler/RequestHandler.php 1 patch
Switch Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 
31 31
 class RequestHandler
32 32
 {
33
-    /**
33
+/**
34 34
      * The request plugin that is able to process the current request
35 35
      *
36 36
      * @var RequestHandlerInterface
37 37
      */
38
-    private $xRequestPlugin = null;
38
+private $xRequestPlugin = null;
39 39
 
40
-    /**
40
+/**
41 41
      * The constructor
42 42
      *
43 43
      * @param Container $di
@@ -46,110 +46,110 @@  discard block
 block discarded – undo
46 46
      * @param CallbackManager $xCallbackManager
47 47
      * @param DatabagPlugin $xDatabagPlugin
48 48
      */
49
-    public function __construct(private Container $di, private PluginManager $xPluginManager,
50
-        private ResponseManager $xResponseManager, private CallbackManager $xCallbackManager,
51
-        private DatabagPlugin $xDatabagPlugin)
52
-    {}
49
+public function __construct(private Container $di, private PluginManager $xPluginManager,
50
+private ResponseManager $xResponseManager, private CallbackManager $xCallbackManager,
51
+private DatabagPlugin $xDatabagPlugin)
52
+{}
53 53
 
54
-    /**
54
+/**
55 55
      * Check if the current request can be processed
56 56
      *
57 57
      * Calls each of the request plugins and determines if the current request can be processed by one of them.
58 58
      *
59 59
      * @return bool
60 60
      */
61
-    public function canProcessRequest(): bool
62
-    {
63
-        // Return true if the request plugin was already found
64
-        if($this->xRequestPlugin !== null)
65
-        {
66
-            return true;
67
-        }
61
+public function canProcessRequest(): bool
62
+{
63
+// Return true if the request plugin was already found
64
+if($this->xRequestPlugin !== null)
65
+{
66
+return true;
67
+}
68 68
 
69
-        // The HTTP request
70
-        $xRequest = $this->di->getRequest();
69
+// The HTTP request
70
+$xRequest = $this->di->getRequest();
71 71
 
72
-        // Find a plugin to process the request
73
-        foreach($this->xPluginManager->getRequestHandlers() as $sClassName)
74
-        {
75
-            if($sClassName::canProcessRequest($xRequest))
76
-            {
77
-                $this->xRequestPlugin = $this->di->g($sClassName);
78
-                $xTarget = $this->xRequestPlugin->setTarget($xRequest);
79
-                $xTarget->setMethodArgs($this->di->getRequestArguments());
80
-                return true;
81
-            }
82
-        }
83
-        return false;
84
-    }
72
+// Find a plugin to process the request
73
+foreach($this->xPluginManager->getRequestHandlers() as $sClassName)
74
+{
75
+if($sClassName::canProcessRequest($xRequest))
76
+{
77
+    $this->xRequestPlugin = $this->di->g($sClassName);
78
+    $xTarget = $this->xRequestPlugin->setTarget($xRequest);
79
+    $xTarget->setMethodArgs($this->di->getRequestArguments());
80
+    return true;
81
+}
82
+}
83
+return false;
84
+}
85 85
 
86
-    /**
86
+/**
87 87
      * Process the current request and handle errors and exceptions.
88 88
      *
89 89
      * @return void
90 90
      * @throws RequestException
91 91
      */
92
-    private function _processRequest(): void
93
-    {
94
-        // Process the request
95
-        if($this->xRequestPlugin !== null)
96
-        {
97
-            $this->xRequestPlugin->processRequest();
98
-            // Process the databag
99
-            $this->xDatabagPlugin->writeCommand();
100
-        }
101
-    }
92
+private function _processRequest(): void
93
+{
94
+// Process the request
95
+if($this->xRequestPlugin !== null)
96
+{
97
+$this->xRequestPlugin->processRequest();
98
+// Process the databag
99
+$this->xDatabagPlugin->writeCommand();
100
+}
101
+}
102 102
 
103
-    /**
103
+/**
104 104
      * Process the current request.
105 105
      *
106 106
      * @return void
107 107
      * @throws RequestException
108 108
      */
109
-    public function processRequest(): void
110
-    {
111
-        // Check if there is a plugin to process this request
112
-        if(!$this->canProcessRequest())
113
-        {
114
-            return;
115
-        }
109
+public function processRequest(): void
110
+{
111
+// Check if there is a plugin to process this request
112
+if(!$this->canProcessRequest())
113
+{
114
+return;
115
+}
116 116
 
117
-        try
118
-        {
119
-            $bEndRequest = false;
120
-            // Handle before processing event
121
-            if($this->xRequestPlugin !== null)
122
-            {
123
-                $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest);
124
-            }
125
-            if($bEndRequest)
126
-            {
127
-                return;
128
-            }
117
+try
118
+{
119
+$bEndRequest = false;
120
+// Handle before processing event
121
+if($this->xRequestPlugin !== null)
122
+{
123
+    $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest);
124
+}
125
+if($bEndRequest)
126
+{
127
+    return;
128
+}
129 129
 
130
-            $this->_processRequest();
130
+$this->_processRequest();
131 131
 
132
-            // Handle after processing event
133
-            if($this->xRequestPlugin !== null)
134
-            {
135
-                $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest);
136
-            }
137
-        }
138
-        // An exception was thrown while processing the request.
139
-        // The request missed the corresponding handler function,
140
-        // or an error occurred while attempting to execute the handler.
141
-        catch(RequestException $e)
142
-        {
143
-            $this->xResponseManager->error($e->getMessage());
144
-            $this->xCallbackManager->onInvalid($e);
145
-        }
146
-        catch(Exception $e)
147
-        {
148
-            $this->xResponseManager->error($e->getMessage());
149
-            $this->xCallbackManager->onError($e);
150
-        }
132
+// Handle after processing event
133
+if($this->xRequestPlugin !== null)
134
+{
135
+    $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest);
136
+}
137
+}
138
+// An exception was thrown while processing the request.
139
+// The request missed the corresponding handler function,
140
+// or an error occurred while attempting to execute the handler.
141
+catch(RequestException $e)
142
+{
143
+$this->xResponseManager->error($e->getMessage());
144
+$this->xCallbackManager->onInvalid($e);
145
+}
146
+catch(Exception $e)
147
+{
148
+$this->xResponseManager->error($e->getMessage());
149
+$this->xCallbackManager->onError($e);
150
+}
151 151
 
152
-        // Print the debug messages
153
-        $this->xResponseManager->printDebug();
154
-    }
152
+// Print the debug messages
153
+$this->xResponseManager->printDebug();
154
+}
155 155
 }
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
-        $aProtected = $xMetadata->getProtectedMethods();
63
+public function testUploadAndExcludeAnnotation()
64
+{
65
+$xMetadata = $this->getAttributes(Annotated::class, ['saveFiles', 'doNot']);
66
+$bExcluded = $xMetadata->isExcluded();
67
+$aProperties = $xMetadata->getProperties();
68
+$aProtected = $xMetadata->getProtectedMethods();
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, $aProtected);
78
-        $this->assertEquals('doNot', $aProtected[0]);
79
-    }
77
+$this->assertCount(1, $aProtected);
78
+$this->assertEquals('doNot', $aProtected[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\App\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\App\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\App\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\App\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
-        $aProtected = $xMetadata->getProtectedMethods();
272
-
273
-        $this->assertTrue($bExcluded);
274
-        $this->assertEmpty($aProperties);
275
-        $this->assertEmpty($aProtected);
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
+$aProtected = $xMetadata->getProtectedMethods();
272
+
273
+$this->assertTrue($bExcluded);
274
+$this->assertEmpty($aProperties);
275
+$this->assertEmpty($aProtected);
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/DocBlockAnnotationTest.php 1 patch
Switch Indentation   +287 added lines, -287 removed lines patch added patch discarded remove patch
@@ -16,320 +16,320 @@
 block discarded – undo
16 16
 
17 17
 class DocBlockAnnotationTest extends TestCase
18 18
 {
19
-    use AnnotationTrait;
19
+use AnnotationTrait;
20 20
 
21
-    /**
21
+/**
22 22
      * @var string
23 23
      */
24
-    protected $sCacheDir;
24
+protected $sCacheDir;
25 25
 
26
-    /**
26
+/**
27 27
      * @throws SetupException
28 28
      */
29
-    public function setUp(): void
30
-    {
31
-        $this->sCacheDir = __DIR__ . '/../tmp';
32
-        @mkdir($this->sCacheDir);
29
+public function setUp(): void
30
+{
31
+$this->sCacheDir = __DIR__ . '/../tmp';
32
+@mkdir($this->sCacheDir);
33 33
 
34
-        jaxon()->di()->getPluginManager()->registerPlugins();
35
-        _register();
34
+jaxon()->di()->getPluginManager()->registerPlugins();
35
+_register();
36 36
 
37
-        jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir);
38
-    }
37
+jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir);
38
+}
39 39
 
40
-    /**
40
+/**
41 41
      * @throws SetupException
42 42
      */
43
-    public function tearDown(): void
44
-    {
45
-        jaxon()->reset();
46
-        parent::tearDown();
47
-
48
-        // Delete the temp dir and all its content
49
-        $aFiles = scandir($this->sCacheDir);
50
-        foreach ($aFiles as $sFile)
51
-        {
52
-            if($sFile !== '.' && $sFile !== '..')
53
-            {
54
-                @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
55
-            }
56
-        }
57
-        @rmdir($this->sCacheDir);
58
-    }
59
-
60
-    /**
43
+public function tearDown(): void
44
+{
45
+jaxon()->reset();
46
+parent::tearDown();
47
+
48
+// Delete the temp dir and all its content
49
+$aFiles = scandir($this->sCacheDir);
50
+foreach ($aFiles as $sFile)
51
+{
52
+if($sFile !== '.' && $sFile !== '..')
53
+{
54
+    @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
55
+}
56
+}
57
+@rmdir($this->sCacheDir);
58
+}
59
+
60
+/**
61 61
      * @throws SetupException
62 62
      */
63
-    public function testUploadAndExcludeAnnotation()
64
-    {
65
-        $xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['saveFiles', 'doNot']);
66
-        $bExcluded = $xMetadata->isExcluded();
67
-        $aProperties = $xMetadata->getProperties();
68
-        $aProtected = $xMetadata->getProtectedMethods();
63
+public function testUploadAndExcludeAnnotation()
64
+{
65
+$xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['saveFiles', 'doNot']);
66
+$bExcluded = $xMetadata->isExcluded();
67
+$aProperties = $xMetadata->getProperties();
68
+$aProtected = $xMetadata->getProtectedMethods();
69 69
 
70
-        $this->assertFalse($bExcluded);
70
+$this->assertFalse($bExcluded);
71 71
 
72
-        $this->assertCount(1, $aProtected);
73
-        $this->assertEquals('doNot', $aProtected[0]);
72
+$this->assertCount(1, $aProtected);
73
+$this->assertEquals('doNot', $aProtected[0]);
74 74
 
75
-        $this->assertCount(1, $aProperties);
76
-        $this->assertArrayHasKey('saveFiles', $aProperties);
77
-        $this->assertCount(1, $aProperties['saveFiles']);
78
-        $this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']);
79
-    }
75
+$this->assertCount(1, $aProperties);
76
+$this->assertArrayHasKey('saveFiles', $aProperties);
77
+$this->assertCount(1, $aProperties['saveFiles']);
78
+$this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']);
79
+}
80 80
 
81
-    /**
81
+/**
82 82
      * @throws SetupException
83 83
      */
84
-    public function testDatabagAnnotation()
85
-    {
86
-        $xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['withBags']);
87
-        $bExcluded = $xMetadata->isExcluded();
88
-        $aProperties = $xMetadata->getProperties();
89
-
90
-        $this->assertFalse($bExcluded);
91
-
92
-        $this->assertCount(1, $aProperties);
93
-        $this->assertArrayHasKey('withBags', $aProperties);
94
-        $this->assertCount(1, $aProperties['withBags']);
95
-        $this->assertCount(2, $aProperties['withBags']['bags']);
96
-        $this->assertEquals('user.name', $aProperties['withBags']['bags'][0]);
97
-        $this->assertEquals('page.number', $aProperties['withBags']['bags'][1]);
98
-    }
99
-
100
-    /**
84
+public function testDatabagAnnotation()
85
+{
86
+$xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['withBags']);
87
+$bExcluded = $xMetadata->isExcluded();
88
+$aProperties = $xMetadata->getProperties();
89
+
90
+$this->assertFalse($bExcluded);
91
+
92
+$this->assertCount(1, $aProperties);
93
+$this->assertArrayHasKey('withBags', $aProperties);
94
+$this->assertCount(1, $aProperties['withBags']);
95
+$this->assertCount(2, $aProperties['withBags']['bags']);
96
+$this->assertEquals('user.name', $aProperties['withBags']['bags'][0]);
97
+$this->assertEquals('page.number', $aProperties['withBags']['bags'][1]);
98
+}
99
+
100
+/**
101 101
      * @throws SetupException
102 102
      */
103
-    public function testCallbackAnnotation()
104
-    {
105
-        $xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['withCallback']);
106
-        $bExcluded = $xMetadata->isExcluded();
107
-        $aProperties = $xMetadata->getProperties();
108
-
109
-        $this->assertFalse($bExcluded);
110
-
111
-        $this->assertCount(1, $aProperties);
112
-        $this->assertArrayHasKey('withCallback', $aProperties);
113
-        $this->assertCount(1, $aProperties['withCallback']);
114
-        $this->assertIsArray($aProperties['withCallback']['callback']);
115
-        $this->assertEquals('jaxon.ajax.callback.test', $aProperties['withCallback']['callback'][0]);
116
-    }
117
-
118
-    /**
103
+public function testCallbackAnnotation()
104
+{
105
+$xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['withCallback']);
106
+$bExcluded = $xMetadata->isExcluded();
107
+$aProperties = $xMetadata->getProperties();
108
+
109
+$this->assertFalse($bExcluded);
110
+
111
+$this->assertCount(1, $aProperties);
112
+$this->assertArrayHasKey('withCallback', $aProperties);
113
+$this->assertCount(1, $aProperties['withCallback']);
114
+$this->assertIsArray($aProperties['withCallback']['callback']);
115
+$this->assertEquals('jaxon.ajax.callback.test', $aProperties['withCallback']['callback'][0]);
116
+}
117
+
118
+/**
119 119
      * @throws SetupException
120 120
      */
121
-    public function testHooksAnnotation()
122
-    {
123
-        $xMetadata = $this->getAttributes(DocBlockAnnotated::class,
124
-            ['cbSingle', 'cbMultiple', 'cbParams']);
125
-        $bExcluded = $xMetadata->isExcluded();
126
-        $aProperties = $xMetadata->getProperties();
127
-
128
-        $this->assertFalse($bExcluded);
129
-
130
-        $this->assertCount(3, $aProperties);
131
-        $this->assertArrayHasKey('cbSingle', $aProperties);
132
-        $this->assertArrayHasKey('cbMultiple', $aProperties);
133
-        $this->assertArrayHasKey('cbParams', $aProperties);
134
-
135
-        $this->assertCount(1, $aProperties['cbSingle']['__before']);
136
-        $this->assertCount(2, $aProperties['cbMultiple']['__before']);
137
-        $this->assertCount(2, $aProperties['cbParams']['__before']);
138
-        $this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']);
139
-        $this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']);
140
-        $this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']);
141
-        $this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']);
142
-        $this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']);
143
-        $this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']);
144
-        $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']);
145
-        $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']);
146
-        $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']);
147
-        $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']);
148
-
149
-        $this->assertCount(1, $aProperties['cbSingle']['__after']);
150
-        $this->assertCount(3, $aProperties['cbMultiple']['__after']);
151
-        $this->assertCount(1, $aProperties['cbParams']['__after']);
152
-        $this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']);
153
-        $this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']);
154
-        $this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']);
155
-        $this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']);
156
-        $this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']);
157
-        $this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']);
158
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']);
159
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']);
160
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']);
161
-        $this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']);
162
-    }
163
-
164
-    /**
121
+public function testHooksAnnotation()
122
+{
123
+$xMetadata = $this->getAttributes(DocBlockAnnotated::class,
124
+['cbSingle', 'cbMultiple', 'cbParams']);
125
+$bExcluded = $xMetadata->isExcluded();
126
+$aProperties = $xMetadata->getProperties();
127
+
128
+$this->assertFalse($bExcluded);
129
+
130
+$this->assertCount(3, $aProperties);
131
+$this->assertArrayHasKey('cbSingle', $aProperties);
132
+$this->assertArrayHasKey('cbMultiple', $aProperties);
133
+$this->assertArrayHasKey('cbParams', $aProperties);
134
+
135
+$this->assertCount(1, $aProperties['cbSingle']['__before']);
136
+$this->assertCount(2, $aProperties['cbMultiple']['__before']);
137
+$this->assertCount(2, $aProperties['cbParams']['__before']);
138
+$this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']);
139
+$this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']);
140
+$this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']);
141
+$this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']);
142
+$this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']);
143
+$this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']);
144
+$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']);
145
+$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']);
146
+$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']);
147
+$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']);
148
+
149
+$this->assertCount(1, $aProperties['cbSingle']['__after']);
150
+$this->assertCount(3, $aProperties['cbMultiple']['__after']);
151
+$this->assertCount(1, $aProperties['cbParams']['__after']);
152
+$this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']);
153
+$this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']);
154
+$this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']);
155
+$this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']);
156
+$this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']);
157
+$this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']);
158
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']);
159
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']);
160
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']);
161
+$this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']);
162
+}
163
+
164
+/**
165 165
      * @throws SetupException
166 166
      */
167
-    public function testContainerAnnotation()
168
-    {
169
-        $xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['di1', 'di2']);
170
-        $bExcluded = $xMetadata->isExcluded();
171
-        $aProperties = $xMetadata->getProperties();
172
-
173
-        $this->assertFalse($bExcluded);
174
-
175
-        $this->assertCount(2, $aProperties);
176
-        $this->assertArrayHasKey('di1', $aProperties);
177
-        $this->assertArrayHasKey('di2', $aProperties);
178
-        $this->assertCount(2, $aProperties['di1']['__di']);
179
-        $this->assertCount(2, $aProperties['di2']['__di']);
180
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']);
181
-        $this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['di1']['__di']['fontService']);
182
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']);
183
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']);
184
-    }
185
-
186
-    /**
167
+public function testContainerAnnotation()
168
+{
169
+$xMetadata = $this->getAttributes(DocBlockAnnotated::class, ['di1', 'di2']);
170
+$bExcluded = $xMetadata->isExcluded();
171
+$aProperties = $xMetadata->getProperties();
172
+
173
+$this->assertFalse($bExcluded);
174
+
175
+$this->assertCount(2, $aProperties);
176
+$this->assertArrayHasKey('di1', $aProperties);
177
+$this->assertArrayHasKey('di2', $aProperties);
178
+$this->assertCount(2, $aProperties['di1']['__di']);
179
+$this->assertCount(2, $aProperties['di2']['__di']);
180
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']);
181
+$this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['di1']['__di']['fontService']);
182
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']);
183
+$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']);
184
+}
185
+
186
+/**
187 187
      * @throws SetupException
188 188
      */
189
-    public function testClassAnnotation()
190
-    {
191
-        $xMetadata = $this->getAttributes(DocBlockClassAnnotated::class, []);
192
-        // $this->assertEquals('', json_encode($aProperties));
193
-        $bExcluded = $xMetadata->isExcluded();
194
-        $aProperties = $xMetadata->getProperties();
195
-
196
-        $this->assertFalse($bExcluded);
197
-
198
-        $this->assertCount(1, $aProperties);
199
-        $this->assertArrayHasKey('*', $aProperties);
200
-        $this->assertCount(5, $aProperties['*']);
201
-        $this->assertArrayHasKey('bags', $aProperties['*']);
202
-        $this->assertArrayHasKey('callback', $aProperties['*']);
203
-        $this->assertArrayHasKey('__before', $aProperties['*']);
204
-        $this->assertArrayHasKey('__after', $aProperties['*']);
205
-
206
-        $this->assertCount(2, $aProperties['*']['bags']);
207
-        $this->assertEquals('user.name', $aProperties['*']['bags'][0]);
208
-        $this->assertEquals('page.number', $aProperties['*']['bags'][1]);
209
-
210
-        $this->assertIsArray($aProperties['*']['callback']);
211
-        $this->assertEquals('jaxon.ajax.callback.test', $aProperties['*']['callback'][0]);
212
-
213
-        $this->assertCount(2, $aProperties['*']['__before']);
214
-        $this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']);
215
-        $this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']);
216
-        $this->assertIsArray($aProperties['*']['__before']['funcBefore1']);
217
-        $this->assertIsArray($aProperties['*']['__before']['funcBefore2']);
218
-
219
-        $this->assertCount(3, $aProperties['*']['__after']);
220
-        $this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']);
221
-        $this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']);
222
-        $this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']);
223
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter1']);
224
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter2']);
225
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter3']);
226
-
227
-        $this->assertCount(3, $aProperties['*']['__di']);
228
-        $this->assertArrayHasKey('colorService', $aProperties['*']['__di']);
229
-        $this->assertArrayHasKey('textService', $aProperties['*']['__di']);
230
-        $this->assertArrayHasKey('fontService', $aProperties['*']['__di']);
231
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']);
232
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']);
233
-        $this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService']);
234
-    }
235
-
236
-    /**
189
+public function testClassAnnotation()
190
+{
191
+$xMetadata = $this->getAttributes(DocBlockClassAnnotated::class, []);
192
+// $this->assertEquals('', json_encode($aProperties));
193
+$bExcluded = $xMetadata->isExcluded();
194
+$aProperties = $xMetadata->getProperties();
195
+
196
+$this->assertFalse($bExcluded);
197
+
198
+$this->assertCount(1, $aProperties);
199
+$this->assertArrayHasKey('*', $aProperties);
200
+$this->assertCount(5, $aProperties['*']);
201
+$this->assertArrayHasKey('bags', $aProperties['*']);
202
+$this->assertArrayHasKey('callback', $aProperties['*']);
203
+$this->assertArrayHasKey('__before', $aProperties['*']);
204
+$this->assertArrayHasKey('__after', $aProperties['*']);
205
+
206
+$this->assertCount(2, $aProperties['*']['bags']);
207
+$this->assertEquals('user.name', $aProperties['*']['bags'][0]);
208
+$this->assertEquals('page.number', $aProperties['*']['bags'][1]);
209
+
210
+$this->assertIsArray($aProperties['*']['callback']);
211
+$this->assertEquals('jaxon.ajax.callback.test', $aProperties['*']['callback'][0]);
212
+
213
+$this->assertCount(2, $aProperties['*']['__before']);
214
+$this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']);
215
+$this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']);
216
+$this->assertIsArray($aProperties['*']['__before']['funcBefore1']);
217
+$this->assertIsArray($aProperties['*']['__before']['funcBefore2']);
218
+
219
+$this->assertCount(3, $aProperties['*']['__after']);
220
+$this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']);
221
+$this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']);
222
+$this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']);
223
+$this->assertIsArray($aProperties['*']['__after']['funcAfter1']);
224
+$this->assertIsArray($aProperties['*']['__after']['funcAfter2']);
225
+$this->assertIsArray($aProperties['*']['__after']['funcAfter3']);
226
+
227
+$this->assertCount(3, $aProperties['*']['__di']);
228
+$this->assertArrayHasKey('colorService', $aProperties['*']['__di']);
229
+$this->assertArrayHasKey('textService', $aProperties['*']['__di']);
230
+$this->assertArrayHasKey('fontService', $aProperties['*']['__di']);
231
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']);
232
+$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']);
233
+$this->assertEquals('Jaxon\Annotations\Tests\App\Ajax\FontService', $aProperties['*']['__di']['fontService']);
234
+}
235
+
236
+/**
237 237
      * @throws SetupException
238 238
      */
239
-    public function testClassExcludeAnnotation()
240
-    {
241
-        $xMetadata = $this->getAttributes(DocBlockClassExcluded::class,
242
-            ['doNot', 'withBags', 'cbSingle']);
243
-        $bExcluded = $xMetadata->isExcluded();
244
-        $aProperties = $xMetadata->getProperties();
245
-        $aProtected = $xMetadata->getProtectedMethods();
246
-
247
-        $this->assertTrue($bExcluded);
248
-        $this->assertEmpty($aProperties);
249
-        $this->assertEmpty($aProtected);
250
-    }
251
-
252
-    public function testUploadAnnotationErrorFieldName()
253
-    {
254
-        $this->expectException(SetupException::class);
255
-        $this->getAttributes(DocBlockAnnotated::class, ['saveFileErrorFieldName']);
256
-    }
257
-
258
-    public function testUploadAnnotationErrorFieldNumber()
259
-    {
260
-        $this->expectException(SetupException::class);
261
-        $this->getAttributes(DocBlockAnnotated::class, ['saveFileErrorFieldNumber']);
262
-    }
263
-
264
-    public function testDatabagAnnotationErrorName()
265
-    {
266
-        $this->expectException(SetupException::class);
267
-        $this->getAttributes(DocBlockAnnotated::class, ['withBagsErrorName']);
268
-    }
269
-
270
-    public function testDatabagAnnotationErrorNumber()
271
-    {
272
-        $this->expectException(SetupException::class);
273
-        $this->getAttributes(DocBlockAnnotated::class, ['withBagsErrorNumber']);
274
-    }
275
-
276
-    public function testContainerAnnotationErrorAttr()
277
-    {
278
-        $this->expectException(SetupException::class);
279
-        $this->getAttributes(DocBlockAnnotated::class, ['diErrorAttr']);
280
-    }
281
-
282
-    public function testContainerAnnotationErrorClass()
283
-    {
284
-        $this->expectException(SetupException::class);
285
-        $this->getAttributes(DocBlockAnnotated::class, ['diErrorClass']);
286
-    }
287
-
288
-    public function testContainerAnnotationErrorOneParam()
289
-    {
290
-        $this->expectException(SetupException::class);
291
-        $this->getAttributes(DocBlockAnnotated::class, ['diErrorOneParam']);
292
-    }
293
-
294
-    public function testContainerAnnotationErrorThreeParams()
295
-    {
296
-        $this->expectException(SetupException::class);
297
-        $this->getAttributes(DocBlockAnnotated::class, ['diErrorThreeParams']);
298
-    }
299
-
300
-    public function testCbBeforeAnnotationErrorName()
301
-    {
302
-        $this->expectException(SetupException::class);
303
-        $this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorName']);
304
-    }
305
-
306
-    public function testCbBeforeAnnotationErrorParam()
307
-    {
308
-        $this->expectException(SetupException::class);
309
-        $this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorParam']);
310
-    }
311
-
312
-    public function testCbBeforeAnnotationErrorNumber()
313
-    {
314
-        $this->expectException(SetupException::class);
315
-        $this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorNumber']);
316
-    }
317
-
318
-    public function testCbAfterAnnotationErrorName()
319
-    {
320
-        $this->expectException(SetupException::class);
321
-        $this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorName']);
322
-    }
323
-
324
-    public function testCbAfterAnnotationErrorParam()
325
-    {
326
-        $this->expectException(SetupException::class);
327
-        $this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorParam']);
328
-    }
329
-
330
-    public function testCbAfterAnnotationErrorNumber()
331
-    {
332
-        $this->expectException(SetupException::class);
333
-        $this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorNumber']);
334
-    }
239
+public function testClassExcludeAnnotation()
240
+{
241
+$xMetadata = $this->getAttributes(DocBlockClassExcluded::class,
242
+['doNot', 'withBags', 'cbSingle']);
243
+$bExcluded = $xMetadata->isExcluded();
244
+$aProperties = $xMetadata->getProperties();
245
+$aProtected = $xMetadata->getProtectedMethods();
246
+
247
+$this->assertTrue($bExcluded);
248
+$this->assertEmpty($aProperties);
249
+$this->assertEmpty($aProtected);
250
+}
251
+
252
+public function testUploadAnnotationErrorFieldName()
253
+{
254
+$this->expectException(SetupException::class);
255
+$this->getAttributes(DocBlockAnnotated::class, ['saveFileErrorFieldName']);
256
+}
257
+
258
+public function testUploadAnnotationErrorFieldNumber()
259
+{
260
+$this->expectException(SetupException::class);
261
+$this->getAttributes(DocBlockAnnotated::class, ['saveFileErrorFieldNumber']);
262
+}
263
+
264
+public function testDatabagAnnotationErrorName()
265
+{
266
+$this->expectException(SetupException::class);
267
+$this->getAttributes(DocBlockAnnotated::class, ['withBagsErrorName']);
268
+}
269
+
270
+public function testDatabagAnnotationErrorNumber()
271
+{
272
+$this->expectException(SetupException::class);
273
+$this->getAttributes(DocBlockAnnotated::class, ['withBagsErrorNumber']);
274
+}
275
+
276
+public function testContainerAnnotationErrorAttr()
277
+{
278
+$this->expectException(SetupException::class);
279
+$this->getAttributes(DocBlockAnnotated::class, ['diErrorAttr']);
280
+}
281
+
282
+public function testContainerAnnotationErrorClass()
283
+{
284
+$this->expectException(SetupException::class);
285
+$this->getAttributes(DocBlockAnnotated::class, ['diErrorClass']);
286
+}
287
+
288
+public function testContainerAnnotationErrorOneParam()
289
+{
290
+$this->expectException(SetupException::class);
291
+$this->getAttributes(DocBlockAnnotated::class, ['diErrorOneParam']);
292
+}
293
+
294
+public function testContainerAnnotationErrorThreeParams()
295
+{
296
+$this->expectException(SetupException::class);
297
+$this->getAttributes(DocBlockAnnotated::class, ['diErrorThreeParams']);
298
+}
299
+
300
+public function testCbBeforeAnnotationErrorName()
301
+{
302
+$this->expectException(SetupException::class);
303
+$this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorName']);
304
+}
305
+
306
+public function testCbBeforeAnnotationErrorParam()
307
+{
308
+$this->expectException(SetupException::class);
309
+$this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorParam']);
310
+}
311
+
312
+public function testCbBeforeAnnotationErrorNumber()
313
+{
314
+$this->expectException(SetupException::class);
315
+$this->getAttributes(DocBlockAnnotated::class, ['cbBeforeErrorNumber']);
316
+}
317
+
318
+public function testCbAfterAnnotationErrorName()
319
+{
320
+$this->expectException(SetupException::class);
321
+$this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorName']);
322
+}
323
+
324
+public function testCbAfterAnnotationErrorParam()
325
+{
326
+$this->expectException(SetupException::class);
327
+$this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorParam']);
328
+}
329
+
330
+public function testCbAfterAnnotationErrorNumber()
331
+{
332
+$this->expectException(SetupException::class);
333
+$this->getAttributes(DocBlockAnnotated::class, ['cbAfterErrorNumber']);
334
+}
335 335
 }
Please login to merge, or discard this patch.