Skip to content

Commit 252fa51

Browse files
committed
Fix the tests and dependencies.
1 parent f6aabe6 commit 252fa51

File tree

7 files changed

+22
-26
lines changed

7 files changed

+22
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Shop at your favorite stores today and experience the freedom to pay later with
1313
SDK covers all of Klarna API: https://developers.klarna.com/api/
1414

1515
### Prerequisites
16-
* PHP 7.1 or above
16+
* PHP 8.1 or above
1717
* [API credentials](#api-credentials)
1818
* [Composer](https://getcomposer.org/) (optional)
1919

composer.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "~10.0",
24-
"squizlabs/php_codesniffer": "1.5.*",
24+
"squizlabs/php_codesniffer": "^3.0",
2525
"phpmd/phpmd": "2.1.*",
26-
"phploc/phploc": "2.0.*",
2726
"php-coveralls/php-coveralls": "^2.1",
2827
"apigen/apigen": "4.1.*",
2928
"klarna/apigen-theme": "2.1.0"
@@ -38,12 +37,7 @@
3837
],
3938
"analyze": [
4039
"mkdir -p build/logs",
41-
"vendor/bin/phploc --log-csv build/logs/phploc.csv src/ tests/",
42-
"mkdir -p build/pdepend",
43-
"vendor/bin/pdepend --jdepend-xml=build/logs/jdepend.xml --jdepend-chart=build/pdepend/dependencies.svg --overview-pyramid=build/pdepend/overview-pyramid.svg src/",
44-
"vendor/bin/phpmd src/,tests/ xml phpmd.xml --reportfile build/logs/pmd.xml || true",
45-
"vendor/bin/phpcs --standard=PSR2 --report=checkstyle --report-file=build/logs/checkstyle.xml --extensions=php src/ tests/",
46-
"vendor/bin/phpcpd --log-pmd build/logs/pmd-cpd.xml src/ tests/ || true"
40+
"vendor/bin/phpcs --standard=PSR2 --report=checkstyle --report-file=build/logs/checkstyle.xml --extensions=php src/ tests/"
4741
]
4842
}
4943
}

src/Klarna/Rest/Resource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function setLocation($url)
106106
/**
107107
* Overrides: Stores the ID KEY field in order to restore it after exchanging the array without
108108
* the ID field.
109-
*
109+
*
110110
* @param array $array Data to be exchanged
111111
*/
112112
public function exchangeArray($array): array

src/Klarna/Rest/Transport/ApiResponse.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ public function setHeaders(array $headers)
104104
$this->headerNames = $this->headers = [];
105105
foreach ($headers as $header => $value) {
106106
if (is_int($header)) {
107-
// Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec
108-
// and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass.
107+
// Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden
108+
// by the spec and also allowed in withHeader().
109+
// So we need to cast it to string again for the following assertion to pass.
109110
$header = (string) $header;
110111
}
111112
$this->assertHeader($header);

src/Klarna/Rest/Transport/GuzzleConnector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public function __construct(
8888

8989
if ($userAgent === null) {
9090
$class = new \ReflectionClass($client);
91-
$version = $class->hasConstant('MAJOR_VERSION') ? $class->getConstant('MAJOR_VERSION') : $class->getConstant('VERSION');
91+
$version = $class->hasConstant('MAJOR_VERSION') ? $class->getConstant('MAJOR_VERSION') :
92+
$class->getConstant('VERSION');
9293
$userAgent = UserAgent::createDefault(['Guzzle/' . $version]);
9394
}
9495
$this->userAgent = $userAgent;

tests/Integration/Checkout/OrderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ public function testHandlingExceptionsUnauthorized()
117117

118118
putenv('PASSWORD=wrong_password');
119119
$output = $this->execFile($this->rootPath . '/docs/examples/CheckoutAPI/handling_exceptions.php');
120-
$this->assertTrue($this->isTextPresents('Unexpected response HTTP status 401', $output));
120+
$this->assertTrue($this->isTextPresents('Code: 401', $output));
121121
}
122122
}

tests/Unit/Checkout/OrderTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ public function testCreate()
7474
->will($this->returnValue('{}'));
7575

7676

77-
$this->response->expects($this->exactly(2))
78-
->method('getHeader')
79-
->willReturnMap([
80-
['Content-Type', ['application/json']],
81-
['Location', ['http://somewhere/a-path']]
82-
]);
77+
$this->response->expects($this->exactly(2))
78+
->method('getHeader')
79+
->willReturnMap([
80+
['Content-Type', ['application/json']],
81+
['Location', ['http://somewhere/a-path']]
82+
]);
8383

8484
$order = new Order($this->connector);
8585
$location = $order->create($data)
@@ -126,12 +126,12 @@ public function testCreateNoContentType()
126126
->method('getStatus')
127127
->will($this->returnValue('201'));
128128

129-
$this->response
130-
->expects($this->exactly(1))
131-
->method('getHeader')
132-
->willReturnMap([
133-
['Content-Type', []]
134-
]);
129+
$this->response
130+
->expects($this->exactly(1))
131+
->method('getHeader')
132+
->willReturnMap([
133+
['Content-Type', []]
134+
]);
135135

136136
$order = new Order($this->connector);
137137

0 commit comments

Comments
 (0)