Skip to content

Commit 7853991

Browse files
committed
Use assertions
1 parent 56f04ac commit 7853991

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/StaticMethodMock.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,24 @@
99

1010
class StaticMethodMock
1111
{
12+
// Static properties
1213
/** @var ?callable */
1314
private static $autoloader = null;
1415
/** @var array<string,StaticMethodMock> */
1516
public static array $mocks = [];
1617

18+
// Instance properties
1719
/** @var string */
1820
private string $className;
1921
/** @var TestCase */
2022
private TestCase $testCase;
2123
/** @var array<int,array{method:string,arguments:array<int,mixed>,returns:mixed,exception:?Throwable}> $expectations*/
2224
private array $expectations;
2325

24-
// Register a static mock for the given class name.
26+
/** Register a static mock for the given class name.
27+
* @param string $className The class name to mock
28+
* @param TestCase $testCase The PHPUnit test case
29+
*/
2530
public function __construct(string $className, TestCase $testCase)
2631
{
2732
$this->className = $className;
@@ -46,7 +51,6 @@ public function __construct(string $className, TestCase $testCase)
4651
* @param mixed $returns The return value if not void
4752
* @param ?Throwable $exception An optional exception to throw
4853
*/
49-
5054
public function expect(string $method, array $arguments, mixed $returns = null, ?Throwable $exception = null): void
5155
{
5256
$this->expectations[] = [
@@ -57,6 +61,7 @@ public function expect(string $method, array $arguments, mixed $returns = null,
5761
];
5862
}
5963

64+
/** Assert that all expectations were met. */
6065
public function assertExpectationsMet(): void
6166
{
6267
if (!empty($this->expectations)) {

0 commit comments

Comments
 (0)