Skip to content

Commit 6dfebf3

Browse files
committed
fix: revert some changes that broke tests
1 parent c0b8f5d commit 6dfebf3

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ parameters:
1212
checkGenericClassInNonGenericObjectType: false
1313
ignoreErrors:
1414
# All Yii setters accept `null` but their phpdoc is incorrect.
15-
- message: '~^Parameter #1 \$value of method yii\\web\\Request::set(.*)\(\) expects (.*), null given.$~'
15+
- message: '~^Parameter #1 \$(.+) of method yii\\web\\Request::set(.+)\(\) expects (.+), null given.$~'
1616
path: 'src/'
1717
- message: '~^Variable \$_COOKIE in isset\(\) always exists and is not nullable.$~'
1818
path: 'src/'

src/Codeception/Lib/Connector/Yii2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ public function doRequest(object $request): \Symfony\Component\BrowserKit\Respon
329329
$yiiRequest = $app->getRequest();
330330
if ($request->getContent() !== null) {
331331
$yiiRequest->setRawBody($request->getContent());
332-
$yiiRequest->setBodyParams([]);
332+
$yiiRequest->setBodyParams(null);
333333
} else {
334-
$yiiRequest->setRawBody('');
334+
$yiiRequest->setRawBody(null);
335335
$yiiRequest->setBodyParams($_POST);
336336
}
337337
$yiiRequest->setQueryParams($_GET);

src/Codeception/Module/Yii2.php

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -690,36 +690,6 @@ public function amOnRoute(string $route, array $params = []): void
690690
$this->amOnPage(Url::to($params));
691691
}
692692

693-
/**
694-
* Opens the page for the given relative URI or route.
695-
*
696-
* ``` php
697-
* <?php
698-
* // opens front page
699-
* $I->amOnPage('/');
700-
* // opens /register page
701-
* $I->amOnPage('/register');
702-
* ```
703-
*
704-
* @param string $page the page URI
705-
*/
706-
public function amOnPage(string $page): void
707-
{
708-
parent::amOnPage($page);
709-
}
710-
711-
/**
712-
* To support to use the behavior of urlManager component
713-
* for the methods like this: amOnPage(), sendAjaxRequest() and etc.
714-
* @param array $parameters
715-
* @param array $files
716-
* @param array $server
717-
*/
718-
protected function clientRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): SymfonyCrawler
719-
{
720-
return parent::clientRequest($method, \Yii::$app->urlManager->createUrl($uri), $parameters, $files, $server, $content, $changeHistory);
721-
}
722-
723693
/**
724694
* Gets a component from the Yii container. Throws an exception if the
725695
* component is not available
@@ -729,12 +699,10 @@ protected function clientRequest(string $method, string $uri, array $parameters
729699
* $mailer = $I->grabComponent('mailer');
730700
* ```
731701
*
732-
* @param $component
733-
* @return mixed
734702
* @throws \Codeception\Exception\ModuleException
735703
* @deprecated in your tests you can use \Yii::$app directly.
736704
*/
737-
public function grabComponent(mixed $component)
705+
public function grabComponent(string $component): null|object
738706
{
739707
try {
740708
return $this->getClient()->getComponent($component);

0 commit comments

Comments
 (0)