@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | protected function setUp(): void { |
| 26 | 26 | parent::setUp(); |
| 27 | - $parser = $this->getMockBuilder( '\Parser' ) |
|
| 27 | + $parser = $this->getMockBuilder('\Parser') |
|
| 28 | 28 | ->disableOriginalConstructor()->getMock(); |
| 29 | - $this->ApiSFSRP = new ApiSemanticFormsSelectRequestProcessor( $parser ); |
|
| 29 | + $this->ApiSFSRP = new ApiSemanticFormsSelectRequestProcessor($parser); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | protected function tearDown(): void { |
| 33 | - unset( $this->ApiSFSRP ); |
|
| 33 | + unset($this->ApiSFSRP); |
|
| 34 | 34 | parent::tearDown(); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $parameters = []; |
| 46 | 46 | |
| 47 | - $this->setExpectedException( 'InvalidArgumentException' ); |
|
| 47 | + $this->setExpectedException('InvalidArgumentException'); |
|
| 48 | 48 | $this->ApiSFSRP->getJsonDecodedResultValuesForRequestParameters( |
| 49 | 49 | $parameters |
| 50 | 50 | ); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function testJsonResultValuesFromRequestParameters() { |
| 54 | 54 | |
| 55 | - $parameters = [ 'query' => 'foo', 'sep' => ',' ]; |
|
| 55 | + $parameters = ['query' => 'foo', 'sep' => ',']; |
|
| 56 | 56 | |
| 57 | 57 | $this->assertInternalType( |
| 58 | 58 | 'object', |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | public function testJsonResultValuesFromRequestParameters_doProcessQueryFor( |
| 66 | 66 | ) { |
| 67 | 67 | |
| 68 | - $parameters = [ 'approach' => 'smw', 'query' => 'foo, baa, gaah', |
|
| 69 | - 'sep' => ',' ]; |
|
| 68 | + $parameters = ['approach' => 'smw', 'query' => 'foo, baa, gaah', |
|
| 69 | + 'sep' => ',']; |
|
| 70 | 70 | |
| 71 | 71 | $this->assertInternalType( |
| 72 | 72 | 'object', |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function testSetDebugFlag() { |
| 80 | - $this->ApiSFSRP->setDebugFlag( true ); |
|
| 81 | - $parameters = [ 'query' => 'foo , function', 'sep' => ',' ]; |
|
| 80 | + $this->ApiSFSRP->setDebugFlag(true); |
|
| 81 | + $parameters = ['query' => 'foo , function', 'sep' => ',']; |
|
| 82 | 82 | |
| 83 | 83 | $this->assertInternalType( |
| 84 | 84 | 'object', |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function testSetDebugFlag_doProcessQueryFor() { |
| 92 | - $this->ApiSFSRP->setDebugFlag( true ); |
|
| 93 | - $parameters = [ 'approach' => 'smw', 'query' => 'my Query,query2', |
|
| 94 | - 'sep' => ',' ]; |
|
| 92 | + $this->ApiSFSRP->setDebugFlag(true); |
|
| 93 | + $parameters = ['approach' => 'smw', 'query' => 'my Query,query2', |
|
| 94 | + 'sep' => ',']; |
|
| 95 | 95 | |
| 96 | 96 | $this->assertInternalType( |
| 97 | 97 | 'object', |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | public function testGetFormattedValuesFrom() { |
| 105 | 105 | $sep = ","; |
| 106 | 106 | $values = "my Query,query2"; |
| 107 | - $result = [ "", "my Query", "query2" ]; |
|
| 107 | + $result = ["", "my Query", "query2"]; |
|
| 108 | 108 | $formattedValues = $this->invokeMethod( |
| 109 | - $this->ApiSFSRP, 'getFormattedValuesFrom', [ $sep, $values ] |
|
| 109 | + $this->ApiSFSRP, 'getFormattedValuesFrom', [$sep, $values] |
|
| 110 | 110 | ); |
| 111 | - $this->assertEquals( $result, $formattedValues ); |
|
| 111 | + $this->assertEquals($result, $formattedValues); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @return mixed Method return. |
| 122 | 122 | */ |
| 123 | - public function invokeMethod( &$object, $methodName, |
|
| 123 | + public function invokeMethod(&$object, $methodName, |
|
| 124 | 124 | array $parameters = [] |
| 125 | 125 | ) { |
| 126 | - $reflection = new \ReflectionClass( get_class( $object ) ); |
|
| 127 | - $method = $reflection->getMethod( $methodName ); |
|
| 128 | - $method->setAccessible( true ); |
|
| 126 | + $reflection = new \ReflectionClass(get_class($object)); |
|
| 127 | + $method = $reflection->getMethod($methodName); |
|
| 128 | + $method->setAccessible(true); |
|
| 129 | 129 | |
| 130 | - return $method->invokeArgs( $object, $parameters ); |
|
| 130 | + return $method->invokeArgs($object, $parameters); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
@@ -24,17 +24,17 @@ discard block |
||
| 24 | 24 | private $SelectField; |
| 25 | 25 | private $parser; |
| 26 | 26 | // Defined variables |
| 27 | - private $other_args_query_parametrized = [ 'query' => '((Category:Building Complex))((Part Of Site::@@@@));?Display Title;format~list;sort~Display Title;sep~,;link~none;headers~hide;limit~500' ]; |
|
| 27 | + private $other_args_query_parametrized = ['query' => '((Category:Building Complex))((Part Of Site::@@@@));?Display Title;format~list;sort~Display Title;sep~,;link~none;headers~hide;limit~500']; |
|
| 28 | 28 | private $expected_result_parametrized_setQuery = "[[Category:Building Complex]][[Part Of Site::@@@@]];?Display Title;format=list;sort=Display Title;sep=,;link=none;headers=hide;limit=500"; |
| 29 | - private $other_args_query_unparametrized = [ 'query' => '((Category:Building Complex));?Display Title;format~list;sort~Display Title;sep~,;link~none;headers~hide;limit~500' ]; |
|
| 30 | - private $other_args_function_parametrized = [ 'function' => '((Category:Building Complex))((Part Of Site::@@@@));?Display Title;format~list;sort~Display Title;sep~,;link~none;headers~hide;limit~500' ]; |
|
| 29 | + private $other_args_query_unparametrized = ['query' => '((Category:Building Complex));?Display Title;format~list;sort~Display Title;sep~,;link~none;headers~hide;limit~500']; |
|
| 30 | + private $other_args_function_parametrized = ['function' => '((Category:Building Complex))((Part Of Site::@@@@));?Display Title;format~list;sort~Display Title;sep~,;link~none;headers~hide;limit~500']; |
|
| 31 | 31 | private $expected_result_parametrized_seFunction = '{{#[[Category:Building Complex]][[Part Of Site::@@@@]];?Display Title;format=list;sort=Display Title;sep=,;link=none;headers=hide;limit=500}}'; |
| 32 | - private $other_args_function_unparametrized = [ 'function' => 'ask:((Category:Building Complex));?Display Title;format~list;sort~Display Title;sep~@@;link~none;headers~hide;limit~500' ]; |
|
| 32 | + private $other_args_function_unparametrized = ['function' => 'ask:((Category:Building Complex));?Display Title;format~list;sort~Display Title;sep~@@;link~none;headers~hide;limit~500']; |
|
| 33 | 33 | private $expected_result_unparametrized_seFunction = "Building Complex:86543eab-4112-4616-be50-17dcdc24c346 (OFD.AEXH)@@Building Complex:5b9e26f8-6c57-48ff-a6b8-42a4e50fe472 (OFD.AEXH)@@Building Complex:93b076aa-cbe9-4371-8b61-c17c26f1872f (OFD.AMEXH)@@Building Complex:59577450-1582-4d6e-9621-3ac0531a728e (OFD.EEXH)@@Building Complex:1a9bed0b-67de-4e71-8528-f2b6a8907814 (RContiAve.Sport Complex)@@Building Complex:6a2242ea-7536-4a6d-85d2-f2ba4398ef44 (TB.BC)@@Building Complex:2db51fb1-10b6-4d4c-a152-f512914781ff (TB.BD)"; |
| 34 | 34 | |
| 35 | 35 | public function testCanConstruct() { |
| 36 | 36 | |
| 37 | - $this->assertInstanceOf( '\SFS\SelectField', $this->SelectField ); |
|
| 37 | + $this->assertInstanceOf('\SFS\SelectField', $this->SelectField); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function testProcessParameters_Query() { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | "", $this->other_args_query_parametrized |
| 44 | 44 | ); |
| 45 | 45 | $this->assertTrue( |
| 46 | - array_key_exists( "query", $this->other_args_query_parametrized ) |
|
| 46 | + array_key_exists("query", $this->other_args_query_parametrized) |
|
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | public function testParametrized_setQuery() { |
| 61 | 61 | |
| 62 | - $this->SelectField->setQuery( $this->other_args_query_parametrized ); |
|
| 62 | + $this->SelectField->setQuery($this->other_args_query_parametrized); |
|
| 63 | 63 | |
| 64 | 64 | $this->assertEquals( |
| 65 | 65 | $this->expected_result_parametrized_setQuery, |
@@ -78,16 +78,16 @@ discard block |
||
| 78 | 78 | $was_replaced |
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | - $this->assertTrue( count( $was_remove[0] ) == 0 ); |
|
| 82 | - $this->assertTrue( count( $was_replaced[0] ) > 0 ); |
|
| 81 | + $this->assertTrue(count($was_remove[0]) == 0); |
|
| 82 | + $this->assertTrue(count($was_replaced[0]) > 0); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | public function testUnparametrized_setQuery() { |
| 86 | 86 | |
| 87 | - $this->SelectField->setQuery( $this->other_args_query_unparametrized ); |
|
| 87 | + $this->SelectField->setQuery($this->other_args_query_unparametrized); |
|
| 88 | 88 | |
| 89 | - $this->assertTrue( $this->SelectField->getValues() !== null ); |
|
| 90 | - $this->assertTrue( $this->SelectField->hasStaticValues() ); |
|
| 89 | + $this->assertTrue($this->SelectField->getValues() !== null); |
|
| 90 | + $this->assertTrue($this->SelectField->hasStaticValues()); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function testParametrized_setFunction() { |
@@ -109,26 +109,26 @@ discard block |
||
| 109 | 109 | $this->other_args_function_unparametrized |
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | - $this->assertTrue( $this->SelectField->hasStaticValues() ); |
|
| 112 | + $this->assertTrue($this->SelectField->hasStaticValues()); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | public function testSetSelectIsMultiple_keyExistTrue() { |
| 116 | - $other_args = [ "part_of_multiple" => "bla bla bla" ]; |
|
| 117 | - $this->SelectField->setSelectIsMultiple( $other_args ); |
|
| 118 | - $this->assertTrue( $this->SelectField->getData()["selectismultiple"] ); |
|
| 116 | + $other_args = ["part_of_multiple" => "bla bla bla"]; |
|
| 117 | + $this->SelectField->setSelectIsMultiple($other_args); |
|
| 118 | + $this->assertTrue($this->SelectField->getData()["selectismultiple"]); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function testSetSelectIsMultiple_keyExistFalse() { |
| 122 | 122 | |
| 123 | - $other_args = [ "Not_part_of_multiple" => "blas blas blas" ]; |
|
| 124 | - $this->SelectField->setSelectIsMultiple( $other_args ); |
|
| 125 | - $this->assertFalse( $this->SelectField->getData()["selectismultiple"] ); |
|
| 123 | + $other_args = ["Not_part_of_multiple" => "blas blas blas"]; |
|
| 124 | + $this->SelectField->setSelectIsMultiple($other_args); |
|
| 125 | + $this->assertFalse($this->SelectField->getData()["selectismultiple"]); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public function testSetSelectTemplate_correctData() { |
| 129 | 129 | $input_name = "{{#[[Category:Building Complex]][[Part Of Site::@@@@]]"; |
| 130 | 130 | $result = "{{#"; |
| 131 | - $this->SelectField->setSelectTemplate( $input_name ); |
|
| 131 | + $this->SelectField->setSelectTemplate($input_name); |
|
| 132 | 132 | |
| 133 | 133 | $this->assertEquals( |
| 134 | 134 | $this->SelectField->getData()['selecttemplate'], $result |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | public function testSetSelectTemplate_wrongData() { |
| 139 | 139 | $input_name = "Category:Building Complex"; |
| 140 | 140 | $result = ""; |
| 141 | - $this->SelectField->setSelectTemplate( $input_name ); |
|
| 141 | + $this->SelectField->setSelectTemplate($input_name); |
|
| 142 | 142 | |
| 143 | 143 | $this->assertEquals( |
| 144 | 144 | $this->SelectField->getData()['selecttemplate'], $result |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $input_name = "{{#[[Category:Building Complex]][[Part Of Site::@@@@]]"; |
| 150 | 150 | $result = "Part Of Site::@@@@]"; |
| 151 | 151 | |
| 152 | - $this->SelectField->setSelectField( $input_name ); |
|
| 152 | + $this->SelectField->setSelectField($input_name); |
|
| 153 | 153 | |
| 154 | 154 | $this->assertEquals( |
| 155 | 155 | $this->SelectField->getData()['selectfield'], $result |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | public function testSetSelectField_wrongData() { |
| 160 | 160 | $input_name = "Category:Building Complex"; |
| 161 | 161 | $result = ""; |
| 162 | - $this->SelectField->setSelectField( $input_name ); |
|
| 162 | + $this->SelectField->setSelectField($input_name); |
|
| 163 | 163 | |
| 164 | 164 | $this->assertNotEquals( |
| 165 | 165 | $this->SelectField->getData()['selectfield'], $result |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | public function testSetValueTemplate_containsMselectTemplate() { |
| 170 | 170 | $input_name = "{{#[[Category:Building Complex]][[Part Of Site::@@@@]]"; |
| 171 | - $other_args = [ "sametemplate" => "test values" ]; |
|
| 171 | + $other_args = ["sametemplate" => "test values"]; |
|
| 172 | 172 | $result = "{{#"; |
| 173 | - $this->SelectField->setSelectTemplate( $input_name ); |
|
| 174 | - $this->SelectField->setValueTemplate( $other_args ); |
|
| 173 | + $this->SelectField->setSelectTemplate($input_name); |
|
| 174 | + $this->SelectField->setValueTemplate($other_args); |
|
| 175 | 175 | |
| 176 | 176 | $this->assertEquals( |
| 177 | 177 | $this->SelectField->getData()["valuetemplate"], $result |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | public function testSetValueTemplate_containsOtherArgsTemplate() { |
| 182 | 182 | |
| 183 | - $other_args = [ "template" => "test values" ]; |
|
| 183 | + $other_args = ["template" => "test values"]; |
|
| 184 | 184 | |
| 185 | - $this->SelectField->setValueTemplate( $other_args ); |
|
| 185 | + $this->SelectField->setValueTemplate($other_args); |
|
| 186 | 186 | |
| 187 | 187 | $this->assertEquals( |
| 188 | 188 | $this->SelectField->getData()["valuetemplate"], |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | public function testSetValueField() { |
| 194 | - $other_args = [ "field" => "test values Field" ]; |
|
| 194 | + $other_args = ["field" => "test values Field"]; |
|
| 195 | 195 | |
| 196 | - $this->SelectField->setValueField( $other_args ); |
|
| 196 | + $this->SelectField->setValueField($other_args); |
|
| 197 | 197 | |
| 198 | 198 | $this->assertEquals( |
| 199 | 199 | $this->SelectField->getData()["valuefield"], $other_args["field"] |
@@ -201,35 +201,35 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | public function testSetSelectRemove_keyExistTrue() { |
| 204 | - $other_args = [ 'rmdiv' => "Test data" ]; |
|
| 205 | - $this->SelectField->setSelectRemove( $other_args ); |
|
| 206 | - $this->assertTrue( $this->SelectField->getData()["selectrm"] ); |
|
| 204 | + $other_args = ['rmdiv' => "Test data"]; |
|
| 205 | + $this->SelectField->setSelectRemove($other_args); |
|
| 206 | + $this->assertTrue($this->SelectField->getData()["selectrm"]); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | public function testSetSelectRemove_keyExistFalse() { |
| 210 | 210 | |
| 211 | - $other_args = [ "no_rmdiv" => "test data" ]; |
|
| 212 | - $this->SelectField->setSelectRemove( $other_args ); |
|
| 213 | - $this->assertFalse( $this->SelectField->getData()["selectrm"] ); |
|
| 211 | + $other_args = ["no_rmdiv" => "test data"]; |
|
| 212 | + $this->SelectField->setSelectRemove($other_args); |
|
| 213 | + $this->assertFalse($this->SelectField->getData()["selectrm"]); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | public function testSetLabel_keyExistTrue() { |
| 217 | - $other_args = [ 'label' => "Test data" ]; |
|
| 218 | - $this->SelectField->setLabel( $other_args ); |
|
| 219 | - $this->assertTrue( $this->SelectField->getData()["label"] ); |
|
| 217 | + $other_args = ['label' => "Test data"]; |
|
| 218 | + $this->SelectField->setLabel($other_args); |
|
| 219 | + $this->assertTrue($this->SelectField->getData()["label"]); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function testSetLabel_keyExistFalse() { |
| 223 | 223 | |
| 224 | - $other_args = [ "no_label" => "test data" ]; |
|
| 225 | - $this->SelectField->setLabel( $other_args ); |
|
| 226 | - $this->assertArrayHasKey( "label", $this->SelectField->getData() ); |
|
| 227 | - $this->assertFalse( $this->SelectField->getData()["label"] ); |
|
| 224 | + $other_args = ["no_label" => "test data"]; |
|
| 225 | + $this->SelectField->setLabel($other_args); |
|
| 226 | + $this->assertArrayHasKey("label", $this->SelectField->getData()); |
|
| 227 | + $this->assertFalse($this->SelectField->getData()["label"]); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | public function testSetDelimiter_keyExistTrue() { |
| 231 | - $other_args = [ "delimiter" => ":" ]; |
|
| 232 | - $this->SelectField->setDelimiter( $other_args ); |
|
| 231 | + $other_args = ["delimiter" => ":"]; |
|
| 232 | + $this->SelectField->setDelimiter($other_args); |
|
| 233 | 233 | $this->assertEquals( |
| 234 | 234 | $this->SelectField->getDelimiter(), $other_args["delimiter"] |
| 235 | 235 | ); |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | public function testSetWgPageFormsListSeparator_keyExistTrue() { |
| 242 | 242 | |
| 243 | - $g_args = [ "Global_delimiter" => ";" ]; |
|
| 244 | - $this->SelectField->setDelimiter( $g_args ); |
|
| 243 | + $g_args = ["Global_delimiter" => ";"]; |
|
| 244 | + $this->SelectField->setDelimiter($g_args); |
|
| 245 | 245 | $this->assertEquals( |
| 246 | 246 | $this->SelectField->getDelimiter(), $g_args["Global_delimiter"] |
| 247 | 247 | ); |
@@ -253,15 +253,15 @@ discard block |
||
| 253 | 253 | protected function setUp(): void { |
| 254 | 254 | parent::setUp(); |
| 255 | 255 | $this->parser = $GLOBALS['wgParser']; |
| 256 | - $this->parser->setTitle( Title::newFromText( 'NO TITLE' ) ); |
|
| 256 | + $this->parser->setTitle(Title::newFromText('NO TITLE')); |
|
| 257 | 257 | $this->parser->mOptions = new ParserOptions(); |
| 258 | 258 | $this->parser->resetOutput(); |
| 259 | 259 | $this->parser->clearState(); |
| 260 | - $this->SelectField = new SelectField( $this->parser ); |
|
| 260 | + $this->SelectField = new SelectField($this->parser); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | protected function tearDown(): void { |
| 264 | - unset( $this->SelectField ); |
|
| 264 | + unset($this->SelectField); |
|
| 265 | 265 | parent::tearDown(); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | $isMandatory = false; |
| 26 | 26 | $isDisabled = false; |
| 27 | 27 | |
| 28 | - $otherArgs = [ 'template' => 'Foo', 'field' => '', |
|
| 29 | - 'function' => 'Bar', 'is_list' => true ]; |
|
| 28 | + $otherArgs = ['template' => 'Foo', 'field' => '', |
|
| 29 | + 'function' => 'Bar', 'is_list' => true]; |
|
| 30 | 30 | |
| 31 | - $parserOutput = $this->getMockBuilder( '\ParserOutput' ) |
|
| 31 | + $parserOutput = $this->getMockBuilder('\ParserOutput') |
|
| 32 | 32 | ->disableOriginalConstructor()->getMock(); |
| 33 | 33 | |
| 34 | - $parser = $this->getMockBuilder( '\Parser' ) |
|
| 34 | + $parser = $this->getMockBuilder('\Parser') |
|
| 35 | 35 | ->disableOriginalConstructor()->getMock(); |
| 36 | 36 | |
| 37 | - $parser->expects( $this->any() )->method( 'getOutput' )->will( |
|
| 38 | - $this->returnValue( $parserOutput ) |
|
| 37 | + $parser->expects($this->any())->method('getOutput')->will( |
|
| 38 | + $this->returnValue($parserOutput) |
|
| 39 | 39 | ); |
| 40 | 40 | $this->SFSInput = new SemanticFormsSelectInput( |
| 41 | 41 | $value, $inputName, $isMandatory, $isDisabled, $otherArgs |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | protected function tearDown(): void { |
| 46 | - unset( $this->SelectField ); |
|
| 46 | + unset($this->SelectField); |
|
| 47 | 47 | parent::tearDown(); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function testGetParameters() { |
| 72 | 72 | |
| 73 | - $this->assertInternalType( 'array', $this->SFSInput->getParameters() ); |
|
| 73 | + $this->assertInternalType('array', $this->SFSInput->getParameters()); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | public function testGetResourceModuleNames() { |
| 78 | - $rsmn = [ 'ext.sf_select.scriptselect' ]; |
|
| 78 | + $rsmn = ['ext.sf_select.scriptselect']; |
|
| 79 | 79 | |
| 80 | - $this->assertEquals( $rsmn, $this->SFSInput->getResourceModuleNames() ); |
|
| 80 | + $this->assertEquals($rsmn, $this->SFSInput->getResourceModuleNames()); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | } |
@@ -24,24 +24,24 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | protected function tearDown(): void { |
| 27 | - unset( $this->data ); |
|
| 27 | + unset($this->data); |
|
| 28 | 28 | parent::tearDown(); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function testCanConstruct() { |
| 32 | - $this->assertInstanceOf( '\SFS\Output', new Output() ); |
|
| 32 | + $this->assertInstanceOf('\SFS\Output', new Output()); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function testAddToHeadItem() { |
| 36 | - $ret = Output::addToHeadItem( $this->data ); |
|
| 36 | + $ret = Output::addToHeadItem($this->data); |
|
| 37 | 37 | |
| 38 | - $this->assertArrayHasKey( 'Foo', $ret ); |
|
| 39 | - $this->assertArrayHasKey( 'Spam', $ret ); |
|
| 38 | + $this->assertArrayHasKey('Foo', $ret); |
|
| 39 | + $this->assertArrayHasKey('Spam', $ret); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function testCommitToParserOutput() { |
| 43 | 43 | global $wgOut; |
| 44 | - $expected_result = '[' . json_encode( $this->data ) . ']'; |
|
| 44 | + $expected_result = '['.json_encode($this->data).']'; |
|
| 45 | 45 | Output::commitToParserOutput(); |
| 46 | 46 | $this->assertEquals( |
| 47 | 47 | $expected_result, $wgOut->getJsConfigVars()['sf_select'] |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | protected function setUp(): void { |
| 26 | 26 | parent::setUp(); |
| 27 | 27 | $parameters = [ 'action' => 'sformsselect', 'approach' => 'smw', |
| 28 | - 'query' => 'abc', 'sep' => ',' ]; |
|
| 28 | + 'query' => 'abc', 'sep' => ',' ]; |
|
| 29 | 29 | |
| 30 | 30 | $this->ApiMain = new ApiMain( |
| 31 | 31 | $this->newRequestContext( $parameters ), true |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | public function testGetParamDescription() { |
| 71 | 71 | $tdata = [ 'approach' => 'The actual approach: function or smw', |
| 72 | - 'query' => 'The query of the former' ]; |
|
| 72 | + 'query' => 'The query of the former' ]; |
|
| 73 | 73 | $this->assertEquals( $this->ApiSFS->getParamDescription(), $tdata ); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | protected function setUp(): void { |
| 26 | 26 | parent::setUp(); |
| 27 | - $parameters = [ 'action' => 'sformsselect', 'approach' => 'smw', |
|
| 28 | - 'query' => 'abc', 'sep' => ',' ]; |
|
| 27 | + $parameters = ['action' => 'sformsselect', 'approach' => 'smw', |
|
| 28 | + 'query' => 'abc', 'sep' => ',']; |
|
| 29 | 29 | |
| 30 | 30 | $this->ApiMain = new ApiMain( |
| 31 | - $this->newRequestContext( $parameters ), true |
|
| 31 | + $this->newRequestContext($parameters), true |
|
| 32 | 32 | ); |
| 33 | 33 | $this->ApiSFS = new ApiSemanticFormsSelect( |
| 34 | 34 | $this->ApiMain, 'sformsselect' |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | protected function tearDown(): void { |
| 39 | - unset( $this->ApiSFS ); |
|
| 40 | - unset( $this->ApiMain ); |
|
| 39 | + unset($this->ApiSFS); |
|
| 40 | + unset($this->ApiMain); |
|
| 41 | 41 | parent::tearDown(); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testCanConstruct() { |
| 46 | 46 | |
| 47 | - $apiMain = new ApiMain( $this->newRequestContext( [] ), true ); |
|
| 47 | + $apiMain = new ApiMain($this->newRequestContext([]), true); |
|
| 48 | 48 | |
| 49 | 49 | $instance = new ApiSemanticFormsSelect( |
| 50 | 50 | $apiMain, 'sformsselect' |
@@ -63,30 +63,30 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function testGetDescription() { |
| 66 | - $tdata = [ 'API for providing SemanticFormsSelect values' ]; |
|
| 67 | - $this->assertEquals( $this->ApiSFS->getDescription(), $tdata ); |
|
| 66 | + $tdata = ['API for providing SemanticFormsSelect values']; |
|
| 67 | + $this->assertEquals($this->ApiSFS->getDescription(), $tdata); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function testGetParamDescription() { |
| 71 | - $tdata = [ 'approach' => 'The actual approach: function or smw', |
|
| 72 | - 'query' => 'The query of the former' ]; |
|
| 73 | - $this->assertEquals( $this->ApiSFS->getParamDescription(), $tdata ); |
|
| 71 | + $tdata = ['approach' => 'The actual approach: function or smw', |
|
| 72 | + 'query' => 'The query of the former']; |
|
| 73 | + $this->assertEquals($this->ApiSFS->getParamDescription(), $tdata); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function testGetVersion() { |
| 77 | 77 | $tdata = 'SFS\ApiSemanticFormsSelect: 1.1'; |
| 78 | - $this->assertEquals( $this->ApiSFS->getVersion(), $tdata ); |
|
| 78 | + $this->assertEquals($this->ApiSFS->getVersion(), $tdata); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | - private function newRequestContext( $request = [] ) { |
|
| 82 | + private function newRequestContext($request = []) { |
|
| 83 | 83 | |
| 84 | 84 | $context = new RequestContext(); |
| 85 | 85 | |
| 86 | - if ( $request instanceof WebRequest ) { |
|
| 87 | - $context->setRequest( $request ); |
|
| 86 | + if ($request instanceof WebRequest) { |
|
| 87 | + $context->setRequest($request); |
|
| 88 | 88 | } else { |
| 89 | - $context->setRequest( new FauxRequest( $request, true ) ); |
|
| 89 | + $context->setRequest(new FauxRequest($request, true)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $context; |