Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: using property promotion on ResponseTraitTest #9397

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor: using property promotion on ResponseTraitTest
samsonasik committed Jan 10, 2025
commit 0ecfb1eb565076bf31ecb652e542cf755a53daa7
26 changes: 4 additions & 22 deletions tests/system/API/ResponseTraitTest.php
Original file line number Diff line number Diff line change
@@ -116,14 +116,10 @@ protected function makeController(string $routePath = '', array $userHeaders = [
return new class ($this->request, $this->response, $this->formatter) {
use ResponseTrait;

protected $request;
protected $response;
protected $formatter;

public function __construct($request, $response, $formatter)
public function __construct(protected $request, protected $response, $formatter)
{
$this->request = $request;
$this->response = $response;
$this->formatter = $formatter;
}

@@ -177,15 +173,11 @@ public function testNoFormatterWithStringAsHtmlTrue(): void
$controller = new class ($this->request, $this->response, $this->formatter) {
use ResponseTrait;

protected $request;
protected $response;
protected $formatter;
protected bool $stringAsHtml = true;

public function __construct($request, $response, $formatter)
public function __construct(protected $request, protected $response, $formatter)
{
$this->request = $request;
$this->response = $response;
$this->formatter = $formatter;
}
};
@@ -299,15 +291,11 @@ public function testRespondSetsCorrectBodyAndStatusWithStringAsHtmlTrue(): void
$controller = new class ($this->request, $this->response, $this->formatter) {
use ResponseTrait;

protected $request;
protected $response;
protected $formatter;
protected bool $stringAsHtml = true;

public function __construct($request, $response, $formatter)
public function __construct(protected $request, protected $response, $formatter)
{
$this->request = $request;
$this->response = $response;
$this->formatter = $formatter;
}
};
@@ -639,14 +627,8 @@ public function testFormatByRequestNegotiateIfFormatIsNotJsonOrXML(): void
$controller = new class ($request, $response) {
use ResponseTrait;

protected $request;
protected $response;

public function __construct($request, $response)
public function __construct(protected $request, protected $response)
{
$this->request = $request;
$this->response = $response;

$this->format = 'txt';
}
};