Skip to content

Commit 973a49f

Browse files
Add test for #6095
1 parent 9018255 commit 973a49f

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/6095
3+
--XFAIL--
4+
https://github.com/sebastianbergmann/phpunit/issues/6095
5+
--FILE--
6+
<?php declare(strict_types=1);
7+
$_SERVER['argv'][] = '--do-not-cache-result';
8+
$_SERVER['argv'][] = '--no-configuration';
9+
$_SERVER['argv'][] = __DIR__ . '/6095/Issue6095Test.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\Issue6095\Issue6095Test::testOne
26+
PHPUnit\TestFixture\MockObject\AnInterface::doSomething() was not expected to be called more than once.
27+
28+
%sIssue6095Test.php:26
29+
30+
FAILURES!
31+
Tests: 1, Assertions: 1, Failures: 1.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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\Issue6095;
11+
12+
use PHPUnit\Framework\TestCase;
13+
use PHPUnit\TestFixture\MockObject\AnInterface;
14+
15+
final class Issue6095Test extends TestCase
16+
{
17+
public function testOne(): void
18+
{
19+
$mock = $this->createMock(AnInterface::class);
20+
21+
$mock
22+
->expects($this->once())
23+
->method('doSomething');
24+
25+
$mock->doSomething();
26+
$mock->doSomething();
27+
}
28+
}

0 commit comments

Comments
 (0)