Skip to content

Commit 54036c6

Browse files
committed
Fix tests
1 parent fb79851 commit 54036c6

File tree

7 files changed

+35
-64
lines changed

7 files changed

+35
-64
lines changed

Diff for: .github/workflows/ci.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
php-version: ['7.4', '8.0', '8.1']
12+
php-version: ['8.0', '8.1']
1313

1414
steps:
1515
- uses: actions/checkout@v2
@@ -18,15 +18,21 @@ jobs:
1818
uses: shivammathur/setup-php@v2
1919
with:
2020
php-version: ${{ matrix.php-version }}
21-
tools: phpunit
21+
tools: composer
2222
env:
2323
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2424

25+
- name: Install dependencies
26+
run: |
27+
composer self-update
28+
composer install --prefer-source --no-interaction
29+
2530
- name: Run tests
26-
run: phpunit
31+
run: vendor/bin/phpunit
2732

2833
- uses: paambaati/[email protected]
2934
env:
3035
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
3136
with:
32-
coverageLocation: ${{github.workspace}}/clover.xml:clover
37+
coverageLocations: |
38+
${{github.workspace}}/clover.xml:clover

Diff for: composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
"authors": [
99
{
1010
"name": "Denis Paavilainen",
11-
"email": "denpa@netfleet.space",
11+
"email": "denpa@denpa.pro",
1212
"role": "Developer"
1313
}
1414
],
1515
"require": {
1616
"php": ">=7.1",
17-
"guzzlehttp/guzzle": "^6.5 | ^7.0"
17+
"guzzlehttp/guzzle": "^7.0"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^7.0 | ^8.0"
20+
"phpunit/phpunit": "^9.5"
2121
},
2222
"autoload": {
2323
"psr-4" : {

Diff for: phpunit.xml.dist

+15-26
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
bootstrap="vendor/autoload.php"
6-
colors="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnError="false"
12-
stopOnFailure="false"
13-
verbose="true"
14-
>
15-
<testsuites>
16-
<testsuite name="Bitcoin API Test Suite">
17-
<directory>tests</directory>
18-
</testsuite>
19-
</testsuites>
20-
<filter>
21-
<whitelist processUncoveredFilesFromWhitelist="true">
22-
<directory suffix=".php">src</directory>
23-
</whitelist>
24-
</filter>
25-
<logging>
26-
<log type="coverage-clover" target="clover.xml"/>
27-
</logging>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnError="false" stopOnFailure="false" verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">src</directory>
6+
</include>
7+
<report>
8+
<clover outputFile="clover.xml"/>
9+
</report>
10+
</coverage>
11+
<testsuites>
12+
<testsuite name="Bitcoin API Test Suite">
13+
<directory>tests</directory>
14+
</testsuite>
15+
</testsuites>
16+
<logging/>
2817
</phpunit>

Diff for: src/Responses/BitcoindResponse.php

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
class BitcoindResponse extends Response implements
1212
\ArrayAccess,
1313
\Countable,
14-
\Serializable,
1514
\JsonSerializable
1615
{
1716
use Collection;

Diff for: src/Traits/Message.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ trait Message
1111
/**
1212
* Retrieves the HTTP protocol version as a string.
1313
*
14-
* @return float
14+
* @return string
1515
*/
16-
public function getProtocolVersion(): float
16+
public function getProtocolVersion(): string
1717
{
1818
return $this->response->getProtocolVersion();
1919
}

Diff for: src/Traits/SerializableContainer.php

-22
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,6 @@
66

77
trait SerializableContainer
88
{
9-
/**
10-
* Returns the string representation of the object.
11-
*
12-
* @return string
13-
*/
14-
public function serialize(): string
15-
{
16-
return serialize($this->toContainer());
17-
}
18-
19-
/**
20-
* Constructs object from serialized string.
21-
*
22-
* @param string $serialized
23-
*
24-
* @return void
25-
*/
26-
public function unserialize($serialized): void
27-
{
28-
$this->container = unserialize($serialized);
29-
}
30-
319
/**
3210
* Returns array containing all the necessary state of the object.
3311
*

Diff for: tests/Responses/BitcoindResponseTest.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,10 @@ public function testCountOnNonArray(): void
470470
*/
471471
public function testProtocolVersion(): void
472472
{
473-
$response = $this->response->withProtocolVersion(1.0);
473+
$response = $this->response->withProtocolVersion('1.1');
474474
$protocolVersion = $response->getProtocolVersion();
475475

476-
$this->assertEquals('1.0', $protocolVersion);
476+
$this->assertEquals('1.1', $protocolVersion);
477477
}
478478

479479
/**
@@ -557,14 +557,13 @@ public function testBody(): void
557557
*/
558558
public function testSerialize(): void
559559
{
560-
$serializedContainer = serialize($this->response->toContainer());
560+
$serializedContainer = serialize($this->response->__serialize());
561561

562562
$serialized = sprintf(
563-
'C:%u:"%s":%u:{%s}',
563+
'O:%u:"%s":1:{%s}',
564564
strlen(BitcoindResponse::class),
565565
BitcoindResponse::class,
566-
strlen($serializedContainer),
567-
$serializedContainer
566+
substr($serializedContainer, 5, (strlen($serializedContainer) - 6))
568567
);
569568

570569
$this->assertEquals(

0 commit comments

Comments
 (0)