normalizeOutput example

$description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $namestatic::getFormat()));
            $data[] = [$object$description];
        }

        return $data;
    }

    protected function assertDescription($expectedDescription$describedObject, array $options = [])
    {
        $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
        $this->getDescriptor()->describe($output$describedObject$options + ['raw_output' => true]);
        $this->assertEquals($this->normalizeOutput($expectedDescription)$this->normalizeOutput($output->fetch()));
    }

    protected function normalizeOutput(string $output)
    {
        $output = str_replace(['%%PHP_SELF%%', '%%PHP_SELF_FULL%%', '%%COMMAND_NAME%%', '%%SHELL%%'][$_SERVER['PHP_SELF']realpath($_SERVER['PHP_SELF'])basename($_SERVER['PHP_SELF'])basename($_SERVER['SHELL'] ?? '')]$output);

        return trim(str_replace(\PHP_EOL, "\n", $output));
    }
}
private function normalizeOutputRecursively($output)
    {
        if (\is_array($output)) {
            return array_map($this->normalizeOutputRecursively(...)$output);
        }

        if (null === $output) {
            return null;
        }

        return parent::normalizeOutput($output);
    }
}
Home | Imprint | This part of the site doesn't use cookies.