Skip to content

Commit

Permalink
Add test for #6095
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 9, 2025
1 parent 9018255 commit 973a49f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/end-to-end/regression/6095.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--TEST--
https://github.com/sebastianbergmann/phpunit/issues/6095
--XFAIL--
https://github.com/sebastianbergmann/phpunit/issues/6095
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = __DIR__ . '/6095/Issue6095Test.php';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

F 1 / 1 (100%)

Time: %s, Memory: %s

There was 1 failure:

1) PHPUnit\TestFixture\Issue6095\Issue6095Test::testOne
PHPUnit\TestFixture\MockObject\AnInterface::doSomething() was not expected to be called more than once.

%sIssue6095Test.php:26

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
28 changes: 28 additions & 0 deletions tests/end-to-end/regression/6095/Issue6095Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture\Issue6095;

use PHPUnit\Framework\TestCase;
use PHPUnit\TestFixture\MockObject\AnInterface;

final class Issue6095Test extends TestCase
{
public function testOne(): void
{
$mock = $this->createMock(AnInterface::class);

$mock
->expects($this->once())
->method('doSomething');

$mock->doSomething();
$mock->doSomething();
}
}

0 comments on commit 973a49f

Please sign in to comment.