getMockBuilder(Application::class) ->setMethods($methods) ->getMock(); } /** * @param PHPUnit_Framework_MockObject_MockObject $object * @param string $method * @param array $arguments * @param mixed $return */ protected function setExpects($object, $method, $arguments, $return = null) { $invocation = $object->expects($this->once()) ->method($method); call_user_func_array([$invocation, 'with'], $arguments); if (!is_null($return)) { $invocation->willReturn($return); } } }