Skip to content

Commit

Permalink
Merge pull request #87 from KuceraMartin/pr/request-factory-from-globals
Browse files Browse the repository at this point in the history
Nette\Http\RequestFactory BC break fixup
  • Loading branch information
Spamercz authored Jan 11, 2021
2 parents 533e695 + 35abe05 commit c753f77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/HttpRequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public function setFakeRequestUrl($url, ?string $scriptPath = NULL): void
}
}

public function createHttpRequest(): \Nette\Http\Request
public function fromGlobals(): \Nette\Http\Request
{
if ($this->fakeUrl === NULL || PHP_SAPI !== Application::CLI_SAPI || !empty($_SERVER['REMOTE_HOST'])) {
return parent::createHttpRequest();
return parent::fromGlobals();
}

return new HttpRequest($this->fakeUrl, NULL, [], [], [], PHP_SAPI, PHP_SAPI, '127.0.0.1', NULL);
Expand Down
2 changes: 1 addition & 1 deletion tests/KdybyTests/Console/HttpRequestFactoryTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class HttpRequestFactoryTest extends \Tester\TestCase
'/path/'
);

$httpRequest = $requestFactory->createHttpRequest();
$httpRequest = $requestFactory->fromGlobals();
Assert::same(Application::CLI_SAPI, $httpRequest->getMethod());

$presenterFactory = new PresenterFactory();
Expand Down

0 comments on commit c753f77

Please sign in to comment.