Skip to content

Commit cd25581

Browse files
Add test for #6138
1 parent 6b2c096 commit cd25581

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

tests/end-to-end/regression/6138.phpt

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/6138
3+
--XFAIL--
4+
https://github.com/sebastianbergmann/phpunit/issues/6138
5+
--FILE--
6+
<?php declare(strict_types=1);
7+
$_SERVER['argv'][] = '--do-not-cache-result';
8+
$_SERVER['argv'][] = '--no-configuration';
9+
$_SERVER['argv'][] = __DIR__ . '/6138/Issue6138Test.php';
10+
11+
require_once __DIR__ . '/../../bootstrap.php';
12+
13+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
14+
--EXPECTF--
15+
PHPUnit %s by Sebastian Bergmann and contributors.
16+
17+
Runtime: %s
18+
19+
F 1 / 1 (100%)
20+
21+
Time: %s, Memory: %s
22+
23+
There was 1 failure:
24+
25+
1) PHPUnit\TestFixture\Issue6138\Issue6138Test::testOne
26+
Expectation failed for method name is "m" when invoked 1 time
27+
Parameter 0 for invocation PHPUnit\TestFixture\Issue6138\I::m(PHPUnit\TestFixture\Issue6138\C Object (...)): void does not match expected value.
28+
Failed asserting that two objects are equal.
29+
--- Expected
30+
+++ Actual
31+
@@ @@
32+
PHPUnit\TestFixture\Issue6138\C Object (
33+
- 'foo' => 'bar'
34+
+ 'foo' => 'baz'
35+
)
36+
37+
%sIssue6138Test.php:%d
38+
39+
FAILURES!
40+
Tests: 1, Assertions: 1, Failures: 1.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\Issue6138;
11+
12+
use PHPUnit\Framework\TestCase;
13+
14+
final class C
15+
{
16+
private string $foo;
17+
18+
public function __construct(string $foo)
19+
{
20+
$this->foo = $foo;
21+
}
22+
}
23+
24+
interface I
25+
{
26+
public function m(C $c): void;
27+
}
28+
29+
final class Issue6138Test extends TestCase
30+
{
31+
public function testOne(): void
32+
{
33+
$i = $this->createMock(I::class);
34+
35+
$i->expects($this->once())->method('m')->with(new C('bar'));
36+
37+
$i->m(new C('baz'));
38+
}
39+
}

0 commit comments

Comments
 (0)