Skip to content

Commit 1f24ab6

Browse files
committed
chubbyphp-mock-2.x
1 parent d760e77 commit 1f24ab6

Some content is hidden

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

42 files changed

+1067
-937
lines changed

Diff for: .github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109109
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
110110
- name: sonarcloud.io
111-
uses: sonarsource/sonarqube-scan-action@v4.2.1
111+
uses: sonarsource/sonarqube-scan-action@v5.0.0
112112
env:
113113
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114114
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Diff for: composer.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@
3434
},
3535
"require-dev": {
3636
"chubbyphp/chubbyphp-dev-helper": "dev-master",
37-
"chubbyphp/chubbyphp-mock": "^1.8",
38-
"infection/infection": "^0.29.10",
37+
"chubbyphp/chubbyphp-mock": "^2.0@dev",
38+
"dg/bypass-finals": "^1.9",
39+
"infection/infection": "^0.29.13",
3940
"php-coveralls/php-coveralls": "^2.7",
4041
"phpstan/extension-installer": "^1.4.3",
41-
"phpstan/phpstan": "^2.1.3",
42-
"phpunit/phpunit": "^11.5.7"
42+
"phpstan/phpstan": "^2.1.6",
43+
"phpunit/phpunit": "^11.5.10"
4344
},
4445
"autoload": {
4546
"psr-4": {

Diff for: phpunit.xml

+5
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@
1515
<file>./src/web.php</file>
1616
</exclude>
1717
</source>
18+
<extensions>
19+
<bootstrap class="DG\BypassFinals\PHPUnitExtension">
20+
<parameter name="bypassFinal" value="true"/>
21+
</bootstrap>
22+
</extensions>
1823
</phpunit>

Diff for: src/RequestHandler/PingRequestHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
2525
;
2626

2727
/** @var non-empty-string $json */
28-
$json = json_encode(['date' => date('c')]);
28+
$json = json_encode(['datetime' => date('c')]);
2929

3030
$response->getBody()->write($json);
3131

Diff for: tests/Integration/PingRequestHandlerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public function testPing(): void
3232

3333
$ping = json_decode($response['body'], true, 512, JSON_THROW_ON_ERROR);
3434

35-
self::assertArrayHasKey('date', $ping);
35+
self::assertArrayHasKey('datetime', $ping);
3636

37-
$date = new \DateTimeImmutable($ping['date']);
37+
$date = new \DateTimeImmutable($ping['datetime']);
3838

3939
self::assertGreaterThanOrEqual($now, $date);
4040
}

Diff for: tests/Unit/Collection/CollectionTest.php

+10-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use App\Collection\AbstractCollection;
88
use App\Collection\CollectionInterface;
99
use App\Model\ModelInterface;
10-
use Chubbyphp\Mock\Call;
11-
use Chubbyphp\Mock\MockByCallsTrait;
10+
use Chubbyphp\Mock\MockMethod\WithReturn;
11+
use Chubbyphp\Mock\MockObjectBuilder;
1212
use PHPUnit\Framework\MockObject\MockObject;
1313
use PHPUnit\Framework\TestCase;
1414

@@ -19,8 +19,6 @@
1919
*/
2020
class CollectionTest extends TestCase
2121
{
22-
use MockByCallsTrait;
23-
2422
public function testGetSet(): void
2523
{
2624
$collection = $this->getCollection();
@@ -32,9 +30,15 @@ public function testGetSet(): void
3230
self::assertSame(0, $collection->getCount());
3331
self::assertSame([], $collection->getItems());
3432

33+
$builder = new MockObjectBuilder();
34+
3535
/** @var MockObject|ModelInterface $model */
36-
$model = $this->getMockByCalls(ModelInterface::class, [
37-
Call::create('jsonSerialize')->with()->willReturn(['id' => '111d1691-8486-4447-997c-d10ce35d1fea']),
36+
$model = $builder->create(ModelInterface::class, [
37+
new WithReturn(
38+
'jsonSerialize',
39+
[],
40+
['id' => '111d1691-8486-4447-997c-d10ce35d1fea']
41+
),
3842
]);
3943

4044
$collection->setOffset(5);

0 commit comments

Comments
 (0)