/** * @internal * For an instance of a Configuration class, execute each of its get methods and * assert they each return a non-empty value * @param Configuration $configs The instantiated instance, e.g. new GitHookConfig($commit) * @param BaseTestCase $phpu * @param string $configurationClassName */ public static function assertConfigurationGetters(Configuration $configs, BaseTestCase $phpu, $configurationClassName) { $logger = \Logger::getLogger(__CLASS__); $reflect = new \ReflectionClass($configurationClassName); $methods = $reflect->getMethods(\ReflectionMethod::IS_PUBLIC); $logger->debug("Iterating over relevant methods for {$configurationClassName}"); foreach ($methods as $method) { if ($method->isStatic()) { continue; } if ($method->isConstructor()) { continue; } $logger->debug("Calling {$method->getName()} for {$configurationClassName}"); $methodName = $method->getName(); // Let's call the method! E.g. $gerritConfig::sshUser() $phpu->assertNotEmpty($configs->{$methodName}(), "{$methodName}()"); } }