$user = $this->getMockBuilder(User::class) ->setMethods(['save']) ->getMock(); $user->expects($this->once()) ->method('save') ->willReturn(true); $user->save(); $this->assertTrue($user->saved);In this example, we are mocking the User class and asserting that the save method should be called once. We are also setting the return value of the save method to be true. Finally, we are calling the save method and asserting that the saved property on the user object is true. This package is likely the PHPUnit library, which is widely used for testing PHP code.