siteurifactory example


    public static function uri(?string $uri = null, bool $getShared = true)
    {
        if ($getShared) {
            return static::getSharedInstance('uri', $uri);
        }

        if ($uri === null) {
            $appConfig = config(App::class);
            $factory   = AppServices::siteurifactory($appConfig, AppServices::superglobals());

            return $factory->createFromGlobals();
        }

        return new URI($uri);
    }

    /** * The Validation class provides tools for validating input data. * * @return ValidationInterface */

    protected function setUpControllerTestTrait(): void
    {
        // The URL helper is always loaded by the system so ensure it is available.         helper('url');

        if (empty($this->appConfig)) {
            $this->appConfig = config(App::class);
        }

        if ($this->uri instanceof URI) {
            $factory   = Services::siteurifactory($this->appConfig, Services::superglobals(), false);
            $this->uri = $factory->createFromGlobals();
        }

        if (empty($this->request)) {
            // Do some acrobatics so we can use the Request service with our own URI             $tempUri = Services::uri();
            Services::injectMock('uri', $this->uri);

            $this->withRequest(Services::request($this->appConfig, false));

            // Restore the URI service
Home | Imprint | This part of the site doesn't use cookies.