Conditions | 1 |
Paths | 1 |
Total Lines | 55 |
Code Lines | 42 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
83 | public function testIdplistStructured(): void |
||
84 | { |
||
85 | $refl = new ReflectionClass(self::$discoHandler); |
||
86 | $idplistStructured = $refl->getMethod('idplistStructured'); |
||
87 | $idplistStructured->setAccessible(true); |
||
88 | $idpList = $idplistStructured->invokeArgs(self::$discoHandler, [self::$idpList]); |
||
89 | |||
90 | $expected = [ |
||
91 | 'B' => [ |
||
92 | 'https://idp04.example.org' => [ |
||
93 | 'name' => ['en' => 'IdP 04'], |
||
94 | 'tags' => ['A', 'B'], |
||
95 | 'entityid' => 'https://idp04.example.org', |
||
96 | 'UIInfo' => ['Keywords' => ['en' => ['aap','noot','mies']]], |
||
97 | ], |
||
98 | 'https://idp06.example.org' => [ |
||
99 | 'name' => ['en' => 'IdP 06'], |
||
100 | 'tags' => ['B'], |
||
101 | 'entityid' => 'https://idp06.example.org', |
||
102 | 'UIInfo' => ['Keywords' => ['fr' => ['singue','noix','mies'], 'de' => ['Affe', 'Nuss', 'mies']]], |
||
103 | ], |
||
104 | 'https://idp05.example.org' => [ |
||
105 | 'tags' => ['B'], |
||
106 | 'entityid' => 'https://idp05.example.org' |
||
107 | ], |
||
108 | ], |
||
109 | 'A' => [ |
||
110 | 'https://idp03.example.org' => [ |
||
111 | 'name' => ['en' => 'IdP 03'], |
||
112 | 'discopower.weight' => 100, |
||
113 | 'tags' => ['A'], |
||
114 | 'entityid' => 'https://idp03.example.org' |
||
115 | ], |
||
116 | 'https://idp02.example.org' => [ |
||
117 | 'name' => ['en' => 'IdP 02'], |
||
118 | 'tags' => ['A'], |
||
119 | 'entityid' => 'https://idp02.example.org' |
||
120 | ], |
||
121 | 'https://idp04.example.org' => [ |
||
122 | 'name' => ['en' => 'IdP 04'], |
||
123 | 'tags' => ['A','B',], |
||
124 | 'entityid' => 'https://idp04.example.org', |
||
125 | 'UIInfo' => ['Keywords' => ['en' => ['aap','noot','mies']]], |
||
126 | ], |
||
127 | 'https://idp01.example.org' => [ |
||
128 | 'name' => ['en' => 'IdP 01'], |
||
129 | 'discopower.weight' => 1, |
||
130 | 'tags' => ['A'], |
||
131 | 'entityid' => 'https://idp01.example.org' |
||
132 | ], |
||
133 | ], |
||
134 | ]; |
||
135 | $this->assertEquals($expected, $idpList); |
||
136 | $this->assertEquals($expected['A'], $idpList['A']); |
||
137 | $this->assertEquals($expected['B'], $idpList['B']); |
||
138 | } |
||
187 |