public static function _missing_version(array $args) { $service = isset($args['service']) ? $args['service'] : ''; $versions = ApiProvider::defaultProvider()->getVersions($service); $versions = implode("\n", array_map(function ($v) { return "* \"{$v}\""; }, $versions)) ?: '* (none found)'; return <<<EOT A "version" configuration value is required. Specifying a version constraint ensures that your code will not be affected by a breaking change made to the service. For example, when using Vws Blackbox, you can lock your API version to "2015-01-01". Your build of the Sdk has the following version(s) of "{$service}": {$versions} You may provide "latest" to the "version" configuration value to utilize the most recent available API version that your client's API provider can find. Note: Using 'latest' in a production application is not recommended '. EOT; }
public function testThrowsOnBadVersion() { $this->setExpectedException(UnresolvedApiException::class); $p = $this->getTestApiProvider(); ApiProvider::resolve($p, 'api', 'webapi', 'derp'); }