php - Is there a setMethods() Equivalent in Mockery for Mocking Chained Methods -
i mocking chain of methods. can work fine phpunit's mockbuilder; however, wondering if there cleaner way mock them in mockery. my current code looks like: $this->repositorymock = $this->getmockbuilder('repository') ->setmethods(array('method1', 'method2', 'method3')) ->getmock(); $this->repositorymock->expects($this->any()) ->method('method1') ->will($this->returnself()); $this->repositorymock->expects($this->any()) ->method('method2') ->will($this->returnvalue(true)); $this->repositorymock->expects($this->any()) ->method('method3') ->will($this->returnvalue(true)); setmethods won't work when using mockery::mock, following code replacing setmethods mockery's version: $this->repositorymock = mockery::mock('repository') ->setmethods(