$mockObject = $this->getMockBuilder('ClassName') ->getMock();
$mockObject = $this->getMockBuilder('ClassName') ->setMethods(['method1', 'method2']) ->getMock(); $mockObject->expects($this->once()) ->method('method1') ->willReturn('abc'); $mockObject->expects($this->once()) ->method('method2') ->willReturn('xyz');In example 2, we are specifying the methods we want to mock and then setting expectations for those methods. We expect 'method1' to be called once and return 'abc', and we expect 'method2' to be called once and return 'xyz'. The PHP Mock Generator package library is most likely PHPUnit.