The list of endpoints in Api specifications
public getPathTemplates ( string $method = null ) : string[] | ||
$method | string | HTTP method |
Résultat | string[] |
/** * Data provider for testGetEndpoint() * * @return array[] */ public function dataGetEndpointProvider() { $basePaths = static::$userSpec->getPathTemplates(Request::METHOD_GET); $farmRoles = array_filter($basePaths, function ($v) { return preg_match('#^/{envId}/farm-roles#', $v); }); foreach ($farmRoles as $i => $farmRole) { unset($basePaths[$i]); } array_push($basePaths, ...$farmRoles); $data = []; foreach ($basePaths as $basePath) { $data[$basePath] = [$basePath, 'user']; } $basePaths = static::$accountSpec->getPathTemplates(Request::METHOD_GET); foreach ($basePaths as $basePath) { $data[$basePath] = [$basePath, 'account']; } if (file_exists($ignoreFile = $this->getFixturesDirectory() . '/ignorePath.yaml')) { $ignorePaths = yaml_parse_file($ignoreFile); if (!empty($ignorePaths = $ignorePaths['paths'])) { $data = array_filter($data, function ($k) use($ignorePaths) { foreach ($ignorePaths as $path) { if (preg_match("#{$path}#", $k)) { return false; } } return true; }, ARRAY_FILTER_USE_KEY); } } return $data; }
/** * Data provider for testGetEndpoint() * * @return array[] */ public function dataBaseGetEndpointProvider() { $basePaths = $this->userSpec->getPathTemplates(Request::METHOD_GET); $farmRoles = array_filter($basePaths, function ($v) { return preg_match('#^/{envId}/farm-roles#', $v); }); foreach ($farmRoles as $i => $farmRole) { unset($basePaths[$i]); } array_push($basePaths, ...$farmRoles); $data = []; foreach ($basePaths as $basePath) { $data[$basePath] = [$basePath, 'user']; } $basePaths = $this->accountSpec->getPathTemplates(Request::METHOD_GET); foreach ($basePaths as $basePath) { $data[$basePath] = [$basePath, 'account']; } return $data; }