private function skip()

in util/ActionTest.php [300:353]


    private function skip(array $actions)
    {
        if (isset($actions['version']) && isset($actions['reason'])) {
            // Extract version compare constrain
            $version = explode('-', $actions['version']);
            $version = array_map('trim', $version);
            if (empty($version[0])) {
                $version[0] = '0';
            }
            if (empty($version[1])) {
                $version[1] = sprintf("%s", PHP_INT_MAX);
            }
            if (strtolower($version[0]) === 'all' ||
               (version_compare(YamlTests::$esVersion, $version[0], '>=') && version_compare(YamlTests::$esVersion, $version[1], '<='))
            ) {
                $this->skippedTest = true;
                return YamlTests::render(self::TEMPLATE_SKIP_VERSION, [
                    ':testname'  => "__CLASS__ . '::' . __FUNCTION__",
                    ':esversion' => sprintf("'%s'", YamlTests::$esVersion),
                    ':reason'    => sprintf("'%s'", addslashes($actions['reason']))
                ]);
            }
        }
        if (isset($actions['features'])) {
            $features = (array) $actions['features'];
            foreach ($features as $feature) {
                if (!in_array($feature, self::SUPPORTED_FEATURES)) {
                    $this->skippedTest = true;
                    return YamlTests::render(self::TEMPLATE_SKIP_FEATURE, [
                        ':testname' => "__CLASS__ . '::' . __FUNCTION__",
                        ':feature'  => sprintf("'%s'", $feature)
                    ]);
                }
                switch ($feature) {
                    case 'xpack':
                        if (YamlTests::$testSuite !== 'platinum') {
                            $this->skippedTest = true;
                            return YamlTests::render(self::TEMPLATE_SKIP_XPACK, [
                                ':testname' => "__CLASS__ . '::' . __FUNCTION__"
                            ]);
                        }
                        break;
                    case 'no_xpack':
                        if (YamlTests::$testSuite !== 'free') {
                            $this->skippedTest = true;
                            return YamlTests::render(self::TEMPLATE_SKIP_OSS, [
                                ':testname' => "__CLASS__ . '::' . __FUNCTION__"
                            ]);
                        }
                        break;
                }
            }
        }
    }