-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSdkInfoTest.php
More file actions
36 lines (31 loc) · 1.36 KB
/
SdkInfoTest.php
File metadata and controls
36 lines (31 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace SumUp\Tests;
use PHPUnit\Framework\TestCase;
use SumUp\ApiVersion;
use SumUp\SdkInfo;
class SdkInfoTest extends TestCase
{
public function testStandardHeadersIncludeRuntimeMetadata()
{
$headers = [
'Content-Type' => 'application/json',
'Accept' => 'application/problem+json, application/json',
'User-Agent' => SdkInfo::getUserAgent(),
];
$headers = array_merge($headers, SdkInfo::getRuntimeHeaders());
$this->assertSame('application/json', $headers['Content-Type']);
$this->assertSame('application/problem+json, application/json', $headers['Accept']);
$this->assertSame(SdkInfo::getUserAgent(), $headers['User-Agent']);
$this->assertSame(ApiVersion::CURRENT, $headers['X-Sumup-Api-Version']);
$this->assertSame('php', $headers['X-Sumup-Lang']);
$this->assertSame(SdkInfo::getVersion(), $headers['X-Sumup-Package-Version']);
$this->assertSame('php', $headers['X-Sumup-Runtime']);
$this->assertSame(PHP_VERSION, $headers['X-Sumup-Runtime-Version']);
$this->assertNotSame('', $headers['X-Sumup-Os']);
$this->assertNotSame('', $headers['X-Sumup-Arch']);
}
public function testRuntimeHeadersAreStableBetweenCalls()
{
$this->assertSame(SdkInfo::getRuntimeHeaders(), SdkInfo::getRuntimeHeaders());
}
}