Skip to content

Commit

Permalink
Add test and fixture for PR #1423 (#1424)
Browse files Browse the repository at this point in the history
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Co-authored-by: David Tombs <55712554+shsp-davidtombs@users.noreply.github.com>
  • Loading branch information
ghostwriter and SHSP-DavidTombs committed May 19, 2024
1 parent 1b81af7 commit 8acb939
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
15 changes: 15 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5350,6 +5350,21 @@
<code><![CDATA[WithFormatterExpectationTest]]></code>
</UnusedClass>
</file>
<file src="tests/Unit/PHP74/TestCase1132Test.php">
<ArgumentTypeCoercion>
<code><![CDATA['TestCase1132']]></code>
</ArgumentTypeCoercion>
<MixedMethodCall>
<code><![CDATA[saveDummy]]></code>
</MixedMethodCall>
<UndefinedClass>
<code><![CDATA[$mock]]></code>
<code><![CDATA[$mock]]></code>
</UndefinedClass>
<UnusedClass>
<code><![CDATA[TestCase1132Test]]></code>
</UnusedClass>
</file>
<file src="tests/Unit/PHP74/TestCase1402Test.php">
<InvalidArgument>
<code><![CDATA[[1]]]></code>
Expand Down
10 changes: 10 additions & 0 deletions tests/Fixture/PHP74/DummyClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace PHP74;

class DummyClass
{
public int $number;
}
33 changes: 33 additions & 0 deletions tests/Unit/PHP74/TestCase1132Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Unit\PHP74;

use Mockery;
use Mockery\Exception\NoMatchingExpectationException;
use PHP74\DummyClass;
use Tests\Unit\AbstractTestCase;

/**
* @coversDefaultClass Mockery
* @requires PHP 7.4
* @see https://github.com/mockery/mockery/issues/1132
*/
final class TestCase1132Test extends AbstractTestCase
{
public function testCase(): void
{
$mock = Mockery::mock('TestCase1132');

$expectedDummy = new DummyClass();
$expectedDummy->number = 1;

$mock->allows()->saveDummy($expectedDummy);

$this->expectException(NoMatchingExpectationException::class);

$actualDummy = new DummyClass();
$mock->saveDummy($actualDummy);
}
}

0 comments on commit 8acb939

Please sign in to comment.