Skip to content

Commit 590d149

Browse files
authored
Merge pull request #390 from Art4/389-update-to-redmine-508-and-512-in-tests
Update all dependencies
2 parents b4c0059 + a1b6e3a commit 590d149

File tree

99 files changed

+456
-978
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+456
-978
lines changed

.docker/PHP83-Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.3.1-fpm
1+
FROM php:8.3.3-fpm
22

33
RUN apt-get update
44
RUN apt-get --yes --no-install-recommends install \

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777

7878
- name: Upload coverage reports to Codecov
7979
if: ${{ matrix.tool == 'code-coverage' }}
80-
uses: codecov/codecov-action@v3
80+
uses: codecov/codecov-action@v4
8181
with:
8282
token: ${{ secrets.CODECOV_TOKEN }}
8383
files: ./.phpunit.cache/clover.xml

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"guzzlehttp/psr7": "^2",
3535
"php-mock/php-mock-phpunit": "^2.6",
3636
"phpstan/phpstan": "^1.10",
37-
"phpunit/phpunit": "^9 || ^10.5"
37+
"phpunit/phpunit": "^9.5 || ^10.5"
3838
},
3939
"autoload": {
4040
"psr-4": {

docker-compose.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
- ./:/var/www/project/ # Location of the project for php-fpm. Note this should be the same for NGINX.*
1414

1515
redmine-dev:
16-
image: redmine:5.1.1
16+
image: redmine:5.1.2
1717
user: "1000:1000"
1818
ports:
1919
- "3000:3000"
@@ -26,26 +26,26 @@ services:
2626

2727
# Make sure the following services are supported in /tests/RedmineExtension/RedmineInstance.php
2828

29-
redmine-50101:
30-
image: redmine:5.1.1
29+
redmine-50102:
30+
image: redmine:5.1.2
3131
user: "1000:1000"
3232
ports:
3333
- "5101:3000"
3434
environment:
3535
REDMINE_SECRET_KEY_BASE: supersecretkey
3636
REDMINE_PLUGINS_MIGRATE: true
3737
volumes:
38-
- ./.docker/redmine-50101_data/files:/usr/src/redmine/files
39-
- ./.docker/redmine-50101_data/sqlite:/usr/src/redmine/sqlite
38+
- ./.docker/redmine-50102_data/files:/usr/src/redmine/files
39+
- ./.docker/redmine-50102_data/sqlite:/usr/src/redmine/sqlite
4040

41-
redmine-50007:
42-
image: redmine:5.0.7
41+
redmine-50008:
42+
image: redmine:5.0.8
4343
user: "1000:1000"
4444
ports:
4545
- "5007:3000"
4646
environment:
4747
REDMINE_SECRET_KEY_BASE: supersecretkey
4848
REDMINE_PLUGINS_MIGRATE: true
4949
volumes:
50-
- ./.docker/redmine-50007_data/files:/usr/src/redmine/files
51-
- ./.docker/redmine-50007_data/sqlite:/usr/src/redmine/sqlite
50+
- ./.docker/redmine-50008_data/files:/usr/src/redmine/files
51+
- ./.docker/redmine-50008_data/sqlite:/usr/src/redmine/sqlite

tests/Behat/behat.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
default:
22
suites:
3-
redmine_50101:
3+
redmine_50102:
44
paths:
55
- '%paths.base%/features'
66
contexts:
77
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
8-
redmineVersion: '5.1.1'
9-
redmine_50007:
8+
redmineVersion: '5.1.2'
9+
redmine_50008:
1010
paths:
1111
- '%paths.base%/features'
1212
contexts:
1313
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
14-
redmineVersion: '5.0.7'
14+
redmineVersion: '5.0.8'

tests/Fixtures/AssertingHttpClient.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Redmine\Tests\Fixtures;
66

7+
use PHPUnit\Framework\MockObject\MockBuilder;
8+
use PHPUnit\Framework\MockObject\Rule\InvokedCount;
79
use PHPUnit\Framework\TestCase;
810
use Redmine\Http\HttpClient;
911
use Redmine\Http\Request;
@@ -21,8 +23,8 @@ public static function create(TestCase $testCase, array $dataSet, ...$dataSets):
2123
$dataSets = array_merge([$dataSet], $dataSets);
2224

2325
/** @var \PHPUnit\Framework\MockObject\MockObject&HttpClient */
24-
$mock = $testCase->getMockBuilder(HttpClient::class)->getMock();
25-
$mock->expects($testCase->exactly(count($dataSets)))->method('request');
26+
$mock = (new MockBuilder($testCase, HttpClient::class))->getMock();
27+
$mock->expects(new InvokedCount(count($dataSets)))->method('request');
2628

2729
$client = new self($testCase, $mock);
2830

@@ -95,7 +97,7 @@ public function request(Request $request): Response
9597
}
9698

9799
/** @var \PHPUnit\Framework\MockObject\MockObject&Response */
98-
$response = $this->testCase->getMockBuilder(Response::class)->getMock();
100+
$response = (new MockBuilder($this->testCase, Response::class))->getMock();
99101

100102
$response->method('getStatusCode')->willReturn($data['responseCode']);
101103
$response->method('getContentType')->willReturn($data['responseContentType']);

tests/Integration/Psr18ClientRequestGenerationTest.php

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

77
use GuzzleHttp\Psr7\Request;
88
use GuzzleHttp\Psr7\Utils;
9+
use PHPUnit\Framework\Attributes\CoversClass;
10+
use PHPUnit\Framework\Attributes\DataProvider;
911
use PHPUnit\Framework\TestCase;
1012
use Psr\Http\Client\ClientInterface;
1113
use Psr\Http\Message\RequestFactoryInterface;
@@ -14,14 +16,13 @@
1416
use Psr\Http\Message\StreamInterface;
1517
use Redmine\Client\Psr18Client;
1618

19+
#[CoversClass(Psr18Client::class)]
1720
class Psr18ClientRequestGenerationTest extends TestCase
1821
{
1922
/**
20-
* @covers \Redmine\Client\Psr18Client
21-
* @test
22-
*
2323
* @dataProvider createdGetRequestsData
2424
*/
25+
#[DataProvider('createdGetRequestsData')]
2526
public function testPsr18ClientCreatesCorrectRequests(
2627
string $url,
2728
string $apikeyOrUsername,
@@ -34,42 +35,39 @@ public function testPsr18ClientCreatesCorrectRequests(
3435
) {
3536
$response = $this->createMock(ResponseInterface::class);
3637

38+
/** @var ClientInterface|\PHPUnit\Framework\MockObject\MockObject */
3739
$httpClient = $this->createMock(ClientInterface::class);
38-
$httpClient->method('sendRequest')->will(
39-
$this->returnCallback(function ($request) use ($response, $expectedOutput) {
40-
// Create a text representation of the HTTP request
41-
$content = $request->getBody()->__toString();
40+
$httpClient->method('sendRequest')->willReturnCallback(function ($request) use ($response, $expectedOutput) {
41+
// Create a text representation of the HTTP request
42+
$content = $request->getBody()->__toString();
4243

43-
$headers = '';
44+
$headers = '';
4445

45-
foreach ($request->getHeaders() as $k => $v) {
46-
$headers .= $k . ': ' . $request->getHeaderLine($k) . \PHP_EOL;
47-
}
46+
foreach ($request->getHeaders() as $k => $v) {
47+
$headers .= $k . ': ' . $request->getHeaderLine($k) . \PHP_EOL;
48+
}
4849

49-
$statusLine = sprintf(
50-
'%s %s HTTP/%s',
51-
$request->getMethod(),
52-
$request->getUri()->__toString(),
53-
$request->getProtocolVersion()
54-
);
50+
$statusLine = sprintf(
51+
'%s %s HTTP/%s',
52+
$request->getMethod(),
53+
$request->getUri()->__toString(),
54+
$request->getProtocolVersion()
55+
);
5556

56-
$fullRequest = $statusLine . \PHP_EOL .
57-
$headers . \PHP_EOL .
58-
$content
59-
;
57+
$fullRequest = $statusLine . \PHP_EOL .
58+
$headers . \PHP_EOL .
59+
$content
60+
;
6061

61-
$this->assertSame($expectedOutput, $fullRequest);
62+
$this->assertSame($expectedOutput, $fullRequest);
6263

63-
return $response;
64-
})
65-
);
64+
return $response;
65+
});
6666

6767
$requestFactory = $this->createMock(RequestFactoryInterface::class);
68-
$requestFactory->method('createRequest')->will(
69-
$this->returnCallback(function ($method, $uri) {
70-
return new Request($method, $uri);
71-
})
72-
);
68+
$requestFactory->method('createRequest')->willReturnCallback(function ($method, $uri) {
69+
return new Request($method, $uri);
70+
});
7371

7472
$streamFactory = new class () implements StreamFactoryInterface {
7573
public function createStream(string $content = ''): StreamInterface

tests/RedmineExtension/RedmineInstance.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ final class RedmineInstance
1616
public static function getSupportedVersions(): array
1717
{
1818
return [
19-
RedmineVersion::V5_1_1,
20-
RedmineVersion::V5_0_7,
19+
RedmineVersion::V5_1_2,
20+
RedmineVersion::V5_0_8,
2121
];
2222
}
2323

tests/RedmineExtension/RedmineVersion.php

+17
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
enum RedmineVersion: string
88
{
9+
/**
10+
* Redmine 5.1.2
11+
*
12+
* @link https://www.redmine.org/versions/193
13+
* @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_1#512-2024-03-04
14+
*/
15+
case V5_1_2 = '5.1.2';
16+
917
/**
1018
* Redmine 5.1.1
1119
*
@@ -22,6 +30,15 @@ enum RedmineVersion: string
2230
*/
2331
case V5_1_0 = '5.1.0';
2432

33+
/**
34+
* Redmine 5.0.8
35+
*
36+
* @link https://www.redmine.org/versions/192
37+
* @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#508-2024-03-04
38+
*/
39+
40+
case V5_0_8 = '5.0.8';
41+
2542
/**
2643
* Redmine 5.0.7
2744
*

tests/Unit/Api/AbstractApi/DeleteTest.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
namespace Redmine\Tests\Unit\Api\AbstractApi;
66

7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\DataProvider;
79
use PHPUnit\Framework\TestCase;
810
use Redmine\Api\AbstractApi;
911
use Redmine\Client\Client;
1012
use Redmine\Tests\Fixtures\AssertingHttpClient;
1113
use ReflectionMethod;
1214

13-
/**
14-
* @covers \Redmine\Api\AbstractApi::delete
15-
*/
15+
#[CoversClass(AbstractApi::class)]
1616
class DeleteTest extends TestCase
1717
{
1818
public function testDeleteWithHttpClient()
@@ -44,6 +44,7 @@ public function testDeleteWithHttpClient()
4444
/**
4545
* @dataProvider getXmlDecodingFromDeleteMethodData
4646
*/
47+
#[DataProvider('getXmlDecodingFromDeleteMethodData')]
4748
public function testXmlDecodingFromDeleteMethod($response, $expected)
4849
{
4950
$client = $this->createMock(Client::class);

tests/Unit/Api/AbstractApi/GetTest.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
namespace Redmine\Tests\Unit\Api\AbstractApi;
66

7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\DataProvider;
79
use PHPUnit\Framework\TestCase;
810
use Redmine\Api\AbstractApi;
911
use Redmine\Client\Client;
1012
use Redmine\Tests\Fixtures\AssertingHttpClient;
1113
use ReflectionMethod;
1214
use SimpleXMLElement;
1315

14-
/**
15-
* @covers \Redmine\Api\AbstractApi::get
16-
*/
16+
#[CoversClass(AbstractApi::class)]
1717
class GetTest extends TestCase
1818
{
1919
public function testGetWithHttpClient()
@@ -46,6 +46,7 @@ public function testGetWithHttpClient()
4646
/**
4747
* @dataProvider getJsonDecodingFromGetMethodData
4848
*/
49+
#[DataProvider('getJsonDecodingFromGetMethodData')]
4950
public function testJsonDecodingFromGetMethod($response, $decode, $expected)
5051
{
5152
$client = $this->createMock(Client::class);
@@ -80,6 +81,7 @@ public static function getJsonDecodingFromGetMethodData(): array
8081
/**
8182
* @dataProvider getXmlDecodingFromGetMethodData
8283
*/
84+
#[DataProvider('getXmlDecodingFromGetMethodData')]
8385
public function testXmlDecodingFromGetMethod($response, $decode, $expected)
8486
{
8587
$client = $this->createMock(Client::class);

tests/Unit/Api/AbstractApi/PostTest.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
namespace Redmine\Tests\Unit\Api\AbstractApi;
66

7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\DataProvider;
79
use PHPUnit\Framework\TestCase;
810
use Redmine\Api\AbstractApi;
911
use Redmine\Client\Client;
1012
use Redmine\Tests\Fixtures\AssertingHttpClient;
1113
use ReflectionMethod;
1214
use SimpleXMLElement;
1315

14-
/**
15-
* @covers \Redmine\Api\AbstractApi::post
16-
*/
16+
#[CoversClass(AbstractApi::class)]
1717
class PostTest extends TestCase
1818
{
1919
public function testPostWithHttpClient()
@@ -46,6 +46,7 @@ public function testPostWithHttpClient()
4646
/**
4747
* @dataProvider getXmlDecodingFromPostMethodData
4848
*/
49+
#[DataProvider('getXmlDecodingFromPostMethodData')]
4950
public function testXmlDecodingFromPostMethod($response, $expected)
5051
{
5152
$client = $this->createMock(Client::class);

tests/Unit/Api/AbstractApi/PutTest.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
namespace Redmine\Tests\Unit\Api\AbstractApi;
66

7+
use PHPUnit\Framework\Attributes\CoversClass;
8+
use PHPUnit\Framework\Attributes\DataProvider;
79
use PHPUnit\Framework\TestCase;
810
use Redmine\Api\AbstractApi;
911
use Redmine\Client\Client;
1012
use Redmine\Tests\Fixtures\AssertingHttpClient;
1113
use ReflectionMethod;
1214
use SimpleXMLElement;
1315

14-
/**
15-
* @covers \Redmine\Api\AbstractApi::put
16-
*/
16+
#[CoversClass(AbstractApi::class)]
1717
class PutTest extends TestCase
1818
{
1919
public function testPutWithHttpClient()
@@ -46,6 +46,7 @@ public function testPutWithHttpClient()
4646
/**
4747
* @dataProvider getXmlDecodingFromPutMethodData
4848
*/
49+
#[DataProvider('getXmlDecodingFromPutMethodData')]
4950
public function testXmlDecodingFromPutMethod($response, $expected)
5051
{
5152
$client = $this->createMock(Client::class);

0 commit comments

Comments
 (0)