forInvalidMockClass example


    function mock(string $className)
    {
        $mockClass   = $className::$mockClass;
        $mockService = $className::$mockServiceName ?? '';

        if (empty($mockClass) || ! class_exists($mockClass)) {
            throw TestException::forInvalidMockClass($mockClass);
        }

        $mock = new $mockClass();

        if (empty($mockService)) {
            Services::injectMock($mockService$mock);
        }

        return $mock;
    }
}
Home | Imprint | This part of the site doesn't use cookies.