diff --git a/build.xml b/build.xml
index c6e0679..fe9f560 100644
--- a/build.xml
+++ b/build.xml
@@ -81,10 +81,10 @@
-
+
-
+
diff --git a/src/VuFindHttp/Exception/ExceptionInterface.php b/src/VuFindHttp/Exception/ExceptionInterface.php
index 1ee8442..50b8632 100644
--- a/src/VuFindHttp/Exception/ExceptionInterface.php
+++ b/src/VuFindHttp/Exception/ExceptionInterface.php
@@ -26,6 +26,7 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development
*/
+
namespace VuFindHttp\Exception;
/**
diff --git a/src/VuFindHttp/Exception/RuntimeException.php b/src/VuFindHttp/Exception/RuntimeException.php
index 6ab0319..a332dab 100644
--- a/src/VuFindHttp/Exception/RuntimeException.php
+++ b/src/VuFindHttp/Exception/RuntimeException.php
@@ -26,6 +26,7 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development
*/
+
namespace VuFindHttp\Exception;
/**
diff --git a/src/VuFindHttp/HttpService.php b/src/VuFindHttp/HttpService.php
index e7cfeae..91a2b7b 100644
--- a/src/VuFindHttp/HttpService.php
+++ b/src/VuFindHttp/HttpService.php
@@ -26,6 +26,7 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development
*/
+
namespace VuFindHttp;
/**
diff --git a/src/VuFindHttp/HttpServiceAwareInterface.php b/src/VuFindHttp/HttpServiceAwareInterface.php
index c34b420..b9a263a 100644
--- a/src/VuFindHttp/HttpServiceAwareInterface.php
+++ b/src/VuFindHttp/HttpServiceAwareInterface.php
@@ -26,6 +26,7 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development
*/
+
namespace VuFindHttp;
/**
diff --git a/src/VuFindHttp/HttpServiceAwareTrait.php b/src/VuFindHttp/HttpServiceAwareTrait.php
index 75c1014..4a0222f 100644
--- a/src/VuFindHttp/HttpServiceAwareTrait.php
+++ b/src/VuFindHttp/HttpServiceAwareTrait.php
@@ -1,4 +1,5 @@
- * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
- * @copyright Copyright (C) Villanova University 2011
+ * PHP version 7
+ *
+ * Copyright (C) Villanova University 2011-2023.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category VuFind
+ * @package Tests
+ * @author David Maus
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link https://vufind.org/wiki/development:testing:unit_tests Wiki
*/
+
if (file_exists('vendor/autoload.php')) {
require_once 'vendor/autoload.php';
}
diff --git a/tests/phpcs.xml b/tests/phpcs.xml
index ed98953..55f14a4 100644
--- a/tests/phpcs.xml
+++ b/tests/phpcs.xml
@@ -2,12 +2,23 @@
Coding standards for VuFind.
../src
+ .
*/config/*
- */tests/*
+ *.php-cs-fixer.*
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/unit-tests/src/VuFindTest/HttpServiceAwareTraitTest.php b/tests/unit-tests/src/VuFindTest/HttpServiceAwareTraitTest.php
index a6e8393..6cba88b 100644
--- a/tests/unit-tests/src/VuFindTest/HttpServiceAwareTraitTest.php
+++ b/tests/unit-tests/src/VuFindTest/HttpServiceAwareTraitTest.php
@@ -1,4 +1,5 @@
getMockBuilder('VuFindHttp\HttpService')->getMock();
- $test = new HttpServiceAwareTraitTestImplementation();
+ $test = new class () {
+ use \VuFindHttp\HttpServiceAwareTrait;
+ };
$test->setHttpService($mock);
$this->assertEquals($mock, $this->getProperty($test, 'httpService'));
}
@@ -87,8 +91,3 @@ protected function getProperty($object, $property)
return $reflectionProperty->getValue($object);
}
}
-
-class HttpServiceAwareTraitTestImplementation
-{
- use \VuFindHttp\HttpServiceAwareTrait;
-}
diff --git a/tests/unit-tests/src/VuFindTest/HttpServiceTest.php b/tests/unit-tests/src/VuFindTest/HttpServiceTest.php
index a976cc8..f37e47f 100644
--- a/tests/unit-tests/src/VuFindTest/HttpServiceTest.php
+++ b/tests/unit-tests/src/VuFindTest/HttpServiceTest.php
@@ -26,6 +26,7 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development
*/
+
namespace VuFindTest;
use VuFindHttp\HttpService as Service;
@@ -159,11 +160,20 @@ public function testGetAppendsHeaders()
),
$this->equalTo('1.1'),
$this->equalTo(
- ['Host' => 'example.tld', 'Connection' => 'close', 'Accept-Encoding' => 'gzip, deflate','User-Agent' => 'Laminas_Http_Client', 'Content-Type' => 'application/json', 'Accept' => 'application/json']
+ [
+ 'Host' => 'example.tld', 'Connection' => 'close', 'Accept-Encoding' => 'gzip, deflate',
+ 'User-Agent' => 'Laminas_Http_Client', 'Content-Type' => 'application/json',
+ 'Accept' => 'application/json'
+ ]
)
);
$service->setDefaultAdapter($adapter);
- $service->get('http://example.tld', ['foo=bar'], 'test', ["Content-type: application/json", "Accept: application/json"]);
+ $service->get(
+ 'http://example.tld',
+ ['foo=bar'],
+ 'test',
+ ["Content-type: application/json", "Accept: application/json"]
+ );
}
/**
@@ -185,7 +195,11 @@ public function testPostAppendsHeaders()
),
$this->equalTo('1.1'),
$this->equalTo(
- ['Host' => 'example.tld', 'Connection' => 'close', 'Accept-Encoding' => 'gzip, deflate','User-Agent' => 'Laminas_Http_Client', 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Content-Length' => '5']
+ [
+ 'Host' => 'example.tld', 'Connection' => 'close', 'Accept-Encoding' => 'gzip, deflate',
+ 'User-Agent' => 'Laminas_Http_Client', 'Content-Type' => 'application/json',
+ 'Accept' => 'application/json', 'Content-Length' => '5'
+ ]
)
);
$service->setDefaultAdapter($adapter);
@@ -303,7 +317,8 @@ public function testProxifySocks5()
$this->assertEquals('localhost', $config['curloptions'][CURLOPT_PROXY]);
$this->assertEquals('666', $config['curloptions'][CURLOPT_PROXYPORT]);
$this->assertEquals(
- CURLPROXY_SOCKS5, $config['curloptions'][CURLOPT_PROXYTYPE]
+ CURLPROXY_SOCKS5,
+ $config['curloptions'][CURLOPT_PROXYTYPE]
);
$this->assertNotContains(CURLOPT_FOLLOWLOCATION, $config['curloptions']);
}
@@ -483,7 +498,8 @@ public function testCurlAdapterFollowLocation()
$this->assertInstanceOf('Laminas\Http\Client\Adapter\Curl', $adapter);
$config = $adapter->getConfig();
$this->assertEquals(
- '1', $config['curloptions'][CURLOPT_FOLLOWLOCATION] ?? null
+ '1',
+ $config['curloptions'][CURLOPT_FOLLOWLOCATION] ?? null
);
}
diff --git a/tests/vufind.php_cs b/tests/vufind.php-cs-fixer.php
similarity index 70%
rename from tests/vufind.php_cs
rename to tests/vufind.php-cs-fixer.php
index 625bd00..4c7b47a 100644
--- a/tests/vufind.php_cs
+++ b/tests/vufind.php-cs-fixer.php
@@ -1,41 +1,29 @@
in(__DIR__ . '/../src');
+$finder->in(__DIR__)
+ ->in(__DIR__ . '/../src');
$rules = [
+ '@PSR12' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=' => null, '=>' => null],
],
- 'blank_line_after_namespace' => true,
- 'braces' => true,
'cast_spaces' => ['space' => 'none'],
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']],
'concat_space' => ['spacing' => 'one'],
- 'constant_case' => ['case' => 'lower'],
- 'elseif' => true,
- 'encoding' => true,
'ereg_to_preg' => true,
- 'full_opening_tag' => true,
- 'function_declaration' => true,
'function_typehint_space' => true,
- 'indentation_type' => true,
'is_null' => true,
- 'line_ending' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => ['syntax' => 'short'],
'lowercase_cast' => true,
- 'lowercase_keywords' => true,
'magic_constant_casing' => true,
- 'method_argument_space' => true,
'native_function_casing' => true,
'no_blank_lines_after_class_opening' => true,
- 'no_blank_lines_after_phpdoc' => true,
- 'no_blank_lines_before_namespace' => true,
- 'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
@@ -44,11 +32,7 @@
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_singleline_whitespace_before_semicolons' => true,
- 'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
- 'no_spaces_inside_parenthesis' => true,
- 'no_trailing_whitespace' => true,
- 'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unused_imports' => true,
@@ -64,17 +48,11 @@
'php_unit_mock' => true,
'php_unit_no_expectation_annotation' => true,
'pow_to_exponentiation' => true,
- 'single_blank_line_at_eof' => true,
- 'single_class_element_per_statement' => true,
- 'single_import_per_statement' => true,
'single_line_after_imports' => true,
'short_scalar_cast' => true,
'standardize_not_equals' => true,
- 'switch_case_semicolon_to_colon' => true,
- 'switch_case_space' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
- 'visibility_required' => true,
];
$cacheDir = __DIR__ . '/../.php_cs_cache';