79580052

Date: 2025-04-17 20:44:50
Score: 0.5
Natty:
Report link
public function testIsCalledWithTwoParameters()
{
    $mock = $this->createMock(Foo::class);

    $mock->expects($this->once())
        ->method('bar')
        ->with($this->callback(function (int ...$args): true {
            $this->assertCount(2, $args);
            $this->assertEquals(1, $args[0]);
            $this->assertEquals(2, $args[1]);
            return true;
        });

    // will fail
    $mock->bar(1, 2, 3);
}
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: ERO