Passed
Push — main ( 124c22...ff6848 )
by Thierry
07:11
created
jaxon-annotations/tests/Attr/Ajax/AttrAnnotated.php 1 patch
Switch Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -7,130 +7,130 @@
 block discarded – undo
7 7
 
8 8
 class AttrAnnotated extends FuncComponent
9 9
 {
10
-    /**
10
+/**
11 11
      * @var ColorService
12 12
      */
13
-    protected $colorService;
13
+protected $colorService;
14 14
 
15
-    /**
15
+/**
16 16
      * @var FontService
17 17
      */
18
-    protected $fontService;
18
+protected $fontService;
19 19
 
20
-    /**
20
+/**
21 21
      * @var \Jaxon\Annotations\Tests\Service\TextService
22 22
      */
23
-    protected $textService;
23
+protected $textService;
24 24
 
25
-    /**
25
+/**
26 26
      * @di ColorService
27 27
      */
28
-    protected $colorService1;
28
+protected $colorService1;
29 29
 
30
-    /**
30
+/**
31 31
      * @di FontService
32 32
      */
33
-    protected $fontService1;
33
+protected $fontService1;
34 34
 
35
-    /**
35
+/**
36 36
      * @di \Jaxon\Annotations\Tests\Service\TextService
37 37
      */
38
-    protected $textService1;
38
+protected $textService1;
39 39
 
40
-    /**
40
+/**
41 41
      * @di
42 42
      * @var ColorService
43 43
      */
44
-    protected $colorService2;
44
+protected $colorService2;
45 45
 
46
-    /**
46
+/**
47 47
      * @di
48 48
      * @var FontService
49 49
      */
50
-    protected $fontService2;
50
+protected $fontService2;
51 51
 
52
-    /**
52
+/**
53 53
      * @di
54 54
      * @var \Jaxon\Annotations\Tests\Service\TextService
55 55
      */
56
-    protected $textService2;
56
+protected $textService2;
57 57
 
58
-    /**
58
+/**
59 59
      * @di('class' => 'ColorService')
60 60
      */
61
-    protected $colorService3;
61
+protected $colorService3;
62 62
 
63
-    /**
63
+/**
64 64
      * @di('class' => 'FontService')
65 65
      */
66
-    protected $fontService3;
66
+protected $fontService3;
67 67
 
68
-    /**
68
+/**
69 69
      * @di('class' => '\Jaxon\Annotations\Tests\Service\TextService')
70 70
      */
71
-    protected $textService3;
71
+protected $textService3;
72 72
 
73
-    /**
73
+/**
74 74
      * @di $fontService FontService
75 75
      */
76
-    protected $errorTwoParams;
76
+protected $errorTwoParams;
77 77
 
78
-    /**
78
+/**
79 79
      * @di('attr' => 'fontService')
80 80
      */
81
-    protected $errorDiAttr;
81
+protected $errorDiAttr;
82 82
 
83
-    /**
83
+/**
84 84
      * @di $fontService
85 85
      */
86
-    protected $errorDiDbAttr;
86
+protected $errorDiDbAttr;
87 87
 
88
-    /**
88
+/**
89 89
      * @di
90 90
      * @di FontService
91 91
      */
92
-    protected $errorTwoDi;
92
+protected $errorTwoDi;
93 93
 
94
-    /**
94
+/**
95 95
      * @di('attr' => 'colorService')
96 96
      * @di('attr' => 'fontService')
97 97
      * @di('attr' => 'textService')
98 98
      */
99
-    public function attrVar()
100
-    {
101
-    }
99
+public function attrVar()
100
+{
101
+}
102 102
 
103
-    /**
103
+/**
104 104
      * @di $colorService
105 105
      * @di $fontService
106 106
      * @di $textService
107 107
      */
108
-    public function attrDbVar()
109
-    {
110
-    }
108
+public function attrDbVar()
109
+{
110
+}
111 111
 
112
-    public function attrDi()
113
-    {
114
-    }
112
+public function attrDi()
113
+{
114
+}
115 115
 
116
-    /**
116
+/**
117 117
      * @di ColorService
118 118
      */
119
-    public function errorDiClass()
120
-    {
121
-    }
119
+public function errorDiClass()
120
+{
121
+}
122 122
 
123
-    /**
123
+/**
124 124
      * @di colorService ColorService
125 125
      */
126
-    public function errorDiNoVar()
127
-    {
128
-    }
126
+public function errorDiNoVar()
127
+{
128
+}
129 129
 
130
-    /**
130
+/**
131 131
      * @di $colorService $ColorService
132 132
      */
133
-    public function errorDiTwoVars()
134
-    {
135
-    }
133
+public function errorDiTwoVars()
134
+{
135
+}
136 136
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/ContainerError.php 1 patch
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
 
7 7
 class ContainerError extends FuncComponent
8 8
 {
9
-    /**
9
+/**
10 10
      * @di('class' => 'Class1')
11 11
      * @di('class' => 'Class2')
12 12
      */
13
-    public $prop;
13
+public $prop;
14 14
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/AnnotationTrait.php 1 patch
Switch Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 trait AnnotationTrait
14 14
 {
15
-    /**
15
+/**
16 16
      * Get the metadata from a given class
17 17
      *
18 18
      * @param ReflectionClass|string $xClass
@@ -21,28 +21,28 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @return Metadata|null
23 23
      */
24
-    public function getAttributes(ReflectionClass|string $xClass,
25
-        array $aMethods = [], array $aProperties = []): ?Metadata
26
-    {
27
-        $xInputData = new InputData($xClass, $aMethods, $aProperties);
28
-        $xMetadataReader = jaxon()->di()->getMetadataReader('annotations');
29
-        return $xMetadataReader->getAttributes($xInputData);
30
-    }
24
+public function getAttributes(ReflectionClass|string $xClass,
25
+array $aMethods = [], array $aProperties = []): ?Metadata
26
+{
27
+$xInputData = new InputData($xClass, $aMethods, $aProperties);
28
+$xMetadataReader = jaxon()->di()->getMetadataReader('annotations');
29
+return $xMetadataReader->getAttributes($xInputData);
30
+}
31 31
 
32
-    /**
32
+/**
33 33
      * @param ReflectionClass $xClass
34 34
      *
35 35
      * @return ComponentOptions
36 36
      */
37
-    public function getOptions(ReflectionClass $xClass): ComponentOptions
38
-    {
39
-        $xConfigSetter = new ConfigSetter();
40
-        $aOptions = [
41
-            'separator' => '.',
42
-            'protected' => [],
43
-            'functions' => [],
44
-            'config' => $xConfigSetter->newConfig(['metadata' => ['format' => 'annotations']]),
45
-        ];
46
-        return jaxon()->cdi()->getComponentOptions($xClass, $aOptions);
47
-    }
37
+public function getOptions(ReflectionClass $xClass): ComponentOptions
38
+{
39
+$xConfigSetter = new ConfigSetter();
40
+$aOptions = [
41
+'separator' => '.',
42
+'protected' => [],
43
+'functions' => [],
44
+'config' => $xConfigSetter->newConfig(['metadata' => ['format' => 'annotations']]),
45
+];
46
+return jaxon()->cdi()->getComponentOptions($xClass, $aOptions);
47
+}
48 48
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/ComponentTest.php 1 patch
Switch Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -18,157 +18,157 @@
 block discarded – undo
18 18
 
19 19
 class ComponentTest extends TestCase
20 20
 {
21
-    use AnnotationTrait;
21
+use AnnotationTrait;
22 22
 
23
-    /**
23
+/**
24 24
      * @var string
25 25
      */
26
-    private $sCacheDir;
26
+private $sCacheDir;
27 27
 
28
-    /**
28
+/**
29 29
      * @throws SetupException
30 30
      */
31
-    public function setUp(): void
32
-    {
33
-        $this->sCacheDir = __DIR__ . '/../tmp';
34
-        @mkdir($this->sCacheDir);
31
+public function setUp(): void
32
+{
33
+$this->sCacheDir = __DIR__ . '/../tmp';
34
+@mkdir($this->sCacheDir);
35 35
 
36
-        jaxon()->di()->getPluginManager()->registerPlugins();
37
-        _register();
36
+jaxon()->di()->getPluginManager()->registerPlugins();
37
+_register();
38 38
 
39
-        jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir);
40
-    }
39
+jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir);
40
+}
41 41
 
42
-    /**
42
+/**
43 43
      * @throws SetupException
44 44
      */
45
-    public function tearDown(): void
46
-    {
47
-        jaxon()->reset();
48
-        parent::tearDown();
49
-
50
-        // Delete the temp dir and all its content
51
-        $aFiles = scandir($this->sCacheDir);
52
-        foreach ($aFiles as $sFile)
53
-        {
54
-            if($sFile !== '.' && $sFile !== '..')
55
-            {
56
-                @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
57
-            }
58
-        }
59
-        @rmdir($this->sCacheDir);
60
-    }
61
-
62
-    /**
45
+public function tearDown(): void
46
+{
47
+jaxon()->reset();
48
+parent::tearDown();
49
+
50
+// Delete the temp dir and all its content
51
+$aFiles = scandir($this->sCacheDir);
52
+foreach ($aFiles as $sFile)
53
+{
54
+if($sFile !== '.' && $sFile !== '..')
55
+{
56
+    @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
57
+}
58
+}
59
+@rmdir($this->sCacheDir);
60
+}
61
+
62
+/**
63 63
      * @throws SetupException
64 64
      */
65
-    public function testNodeComponentExportMethods()
66
-    {
67
-        $xMetadata = $this->getAttributes(NodeComponent::class,
68
-            ['item', 'html', 'render', 'clear', 'visible'], []);
69
-        $bExcluded = $xMetadata->isExcluded();
70
-        $aExcluded = $xMetadata->getExceptMethods();
71
-        $aBaseMethods = $xMetadata->getExportBaseMethods();
72
-        $aOnlyMethods = $xMetadata->getExportOnlyMethods();
73
-
74
-        $this->assertFalse($bExcluded);
75
-        $this->assertCount(0, $aExcluded);
76
-        $this->assertCount(0, $aBaseMethods);
77
-        $this->assertCount(0, $aOnlyMethods);
78
-    }
79
-
80
-    /**
65
+public function testNodeComponentExportMethods()
66
+{
67
+$xMetadata = $this->getAttributes(NodeComponent::class,
68
+['item', 'html', 'render', 'clear', 'visible'], []);
69
+$bExcluded = $xMetadata->isExcluded();
70
+$aExcluded = $xMetadata->getExceptMethods();
71
+$aBaseMethods = $xMetadata->getExportBaseMethods();
72
+$aOnlyMethods = $xMetadata->getExportOnlyMethods();
73
+
74
+$this->assertFalse($bExcluded);
75
+$this->assertCount(0, $aExcluded);
76
+$this->assertCount(0, $aBaseMethods);
77
+$this->assertCount(0, $aOnlyMethods);
78
+}
79
+
80
+/**
81 81
      * @throws SetupException
82 82
      */
83
-    public function testPageComponentExportMethods()
84
-    {
85
-        $xMetadata = $this->getAttributes(PageComponent::class,
86
-            ['item', 'html', 'render', 'clear', 'visible'], []);
87
-        $bExcluded = $xMetadata->isExcluded();
88
-        $aExcluded = $xMetadata->getExceptMethods();
89
-        $aBaseMethods = $xMetadata->getExportBaseMethods();
90
-        $aOnlyMethods = $xMetadata->getExportOnlyMethods();
91
-
92
-        $this->assertFalse($bExcluded);
93
-        $this->assertCount(0, $aExcluded);
94
-        $this->assertCount(0, $aBaseMethods);
95
-        $this->assertCount(0, $aOnlyMethods);
96
-    }
97
-
98
-    /**
83
+public function testPageComponentExportMethods()
84
+{
85
+$xMetadata = $this->getAttributes(PageComponent::class,
86
+['item', 'html', 'render', 'clear', 'visible'], []);
87
+$bExcluded = $xMetadata->isExcluded();
88
+$aExcluded = $xMetadata->getExceptMethods();
89
+$aBaseMethods = $xMetadata->getExportBaseMethods();
90
+$aOnlyMethods = $xMetadata->getExportOnlyMethods();
91
+
92
+$this->assertFalse($bExcluded);
93
+$this->assertCount(0, $aExcluded);
94
+$this->assertCount(0, $aBaseMethods);
95
+$this->assertCount(0, $aOnlyMethods);
96
+}
97
+
98
+/**
99 99
      * @throws SetupException
100 100
      */
101
-    public function testFuncComponentExportMethods()
102
-    {
103
-        $xMetadata = $this->getAttributes(FuncComponent::class,
104
-            ['paginator'], []);
105
-        $bExcluded = $xMetadata->isExcluded();
106
-        $aExcluded = $xMetadata->getExceptMethods();
107
-        $aBaseMethods = $xMetadata->getExportBaseMethods();
108
-        $aOnlyMethods = $xMetadata->getExportOnlyMethods();
109
-
110
-        $this->assertFalse($bExcluded);
111
-        $this->assertCount(0, $aExcluded);
112
-        $this->assertCount(0, $aBaseMethods);
113
-        $this->assertCount(0, $aOnlyMethods);
114
-    }
115
-
116
-    /**
101
+public function testFuncComponentExportMethods()
102
+{
103
+$xMetadata = $this->getAttributes(FuncComponent::class,
104
+['paginator'], []);
105
+$bExcluded = $xMetadata->isExcluded();
106
+$aExcluded = $xMetadata->getExceptMethods();
107
+$aBaseMethods = $xMetadata->getExportBaseMethods();
108
+$aOnlyMethods = $xMetadata->getExportOnlyMethods();
109
+
110
+$this->assertFalse($bExcluded);
111
+$this->assertCount(0, $aExcluded);
112
+$this->assertCount(0, $aBaseMethods);
113
+$this->assertCount(0, $aOnlyMethods);
114
+}
115
+
116
+/**
117 117
      * @throws SetupException
118 118
      */
119
-    public function testNodeComponentExportBaseMethods()
120
-    {
121
-        // The attribute exports the 'html' and 'render' methods,
122
-        // but only the 'render' method shall be exported.
123
-        $xClass = new ReflectionClass(NodeBaseComponent::class);
124
-        $aMethods = ['item', 'html', 'render', 'clear', 'visible'];
125
-        $xMetadata = $this->getAttributes($xClass, $aMethods, []);
126
-        $aBaseMethods = $xMetadata->getExportBaseMethods();
127
-
128
-        // The 'html' and 'render' methods are returned.
129
-        $this->assertCount(2, $aBaseMethods);
130
-
131
-        $xOptions = $this->getOptions($xClass);
132
-        $aPublicMethods = $xOptions->getPublicMethods();
133
-
134
-        // Only the 'render' method is returned.
135
-        $this->assertCount(1, $aPublicMethods);
136
-        $this->assertEquals('render', $aPublicMethods[0]);
137
-    }
138
-
139
-    /**
119
+public function testNodeComponentExportBaseMethods()
120
+{
121
+// The attribute exports the 'html' and 'render' methods,
122
+// but only the 'render' method shall be exported.
123
+$xClass = new ReflectionClass(NodeBaseComponent::class);
124
+$aMethods = ['item', 'html', 'render', 'clear', 'visible'];
125
+$xMetadata = $this->getAttributes($xClass, $aMethods, []);
126
+$aBaseMethods = $xMetadata->getExportBaseMethods();
127
+
128
+// The 'html' and 'render' methods are returned.
129
+$this->assertCount(2, $aBaseMethods);
130
+
131
+$xOptions = $this->getOptions($xClass);
132
+$aPublicMethods = $xOptions->getPublicMethods();
133
+
134
+// Only the 'render' method is returned.
135
+$this->assertCount(1, $aPublicMethods);
136
+$this->assertEquals('render', $aPublicMethods[0]);
137
+}
138
+
139
+/**
140 140
      * @throws SetupException
141 141
      */
142
-    public function testDocBockNodeComponentExportBaseMethods()
143
-    {
144
-        // The attribute exports the 'html' and 'render' methods,
145
-        // but only the 'render' method shall be exported.
146
-        $xClass = new ReflectionClass(DocBlockNodeBaseComponent::class);
147
-        $aMethods = ['item', 'html', 'render', 'clear', 'visible'];
148
-        $xMetadata = $this->getAttributes($xClass, $aMethods, []);
149
-        $aBaseMethods = $xMetadata->getExportBaseMethods();
150
-
151
-        // The 'html' and 'render' methods are returned.
152
-        $this->assertCount(2, $aBaseMethods);
153
-
154
-        $xOptions = $this->getOptions($xClass);
155
-        $aPublicMethods = $xOptions->getPublicMethods();
156
-
157
-        // Only the 'render' method is returned.
158
-        $this->assertCount(1, $aPublicMethods);
159
-        $this->assertEquals('render', $aPublicMethods[0]);
160
-    }
161
-
162
-    public function testAttributeExportError()
163
-    {
164
-        $this->expectException(SetupException::class);
165
-        $xClass = new ReflectionClass(ExportErrorComponent::class);
166
-        $this->getOptions($xClass);
167
-    }
168
-
169
-    // public function testContainerAttributeErrorDiClass()
170
-    // {
171
-    //     $this->expectException(SetupException::class);
172
-    //     $this->getAttributes(PropertyAttribute::class, ['errorDiClass']);
173
-    // }
142
+public function testDocBockNodeComponentExportBaseMethods()
143
+{
144
+// The attribute exports the 'html' and 'render' methods,
145
+// but only the 'render' method shall be exported.
146
+$xClass = new ReflectionClass(DocBlockNodeBaseComponent::class);
147
+$aMethods = ['item', 'html', 'render', 'clear', 'visible'];
148
+$xMetadata = $this->getAttributes($xClass, $aMethods, []);
149
+$aBaseMethods = $xMetadata->getExportBaseMethods();
150
+
151
+// The 'html' and 'render' methods are returned.
152
+$this->assertCount(2, $aBaseMethods);
153
+
154
+$xOptions = $this->getOptions($xClass);
155
+$aPublicMethods = $xOptions->getPublicMethods();
156
+
157
+// Only the 'render' method is returned.
158
+$this->assertCount(1, $aPublicMethods);
159
+$this->assertEquals('render', $aPublicMethods[0]);
160
+}
161
+
162
+public function testAttributeExportError()
163
+{
164
+$this->expectException(SetupException::class);
165
+$xClass = new ReflectionClass(ExportErrorComponent::class);
166
+$this->getOptions($xClass);
167
+}
168
+
169
+// public function testContainerAttributeErrorDiClass()
170
+// {
171
+//     $this->expectException(SetupException::class);
172
+//     $this->getAttributes(PropertyAttribute::class, ['errorDiClass']);
173
+// }
174 174
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/Component/DocBlockNodeBaseComponent.php 1 patch
Switch Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
  */
11 11
 class DocBlockNodeBaseComponent extends BaseComponent
12 12
 {
13
-    use Traits\NodeTrait;
13
+use Traits\NodeTrait;
14 14
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/Component/ExportErrorComponent.php 1 patch
Switch Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
  */
11 11
 class ExportErrorComponent extends BaseComponent
12 12
 {
13
-    use Traits\NodeTrait;
13
+use Traits\NodeTrait;
14 14
 }
Please login to merge, or discard this patch.