php cs fixer

This commit is contained in:
Yisroel Baum 2026-04-19 23:07:48 +03:00
parent 26abaeb739
commit 189493b045
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
17 changed files with 44 additions and 43 deletions

View file

@ -3,7 +3,7 @@
$texts = [
[
'id' => 0,
'name' => 'test text'
'name' => 'test text',
],
];

View file

@ -21,10 +21,10 @@ class BulkCreateNodesTest extends TestCase
public function setUp(): void
{
$this->textRepo = new FakeTextRepository;
$this->textRepo = new FakeTextRepository();
$this->textRepo->create(new CreateTextDto(name: 'text'));
$this->nodeRepo = new FakeNodeRepository;
$this->nodeRepo = new FakeNodeRepository();
$text = $this->textRepo->find(0);
$this->parentNode = $this->nodeRepo->create(new CreateNodeDto(
text: $text,

View file

@ -21,11 +21,11 @@ class CreateNodeTest extends TestCase
public function setUp(): void
{
$this->textRepo = new FakeTextRepository;
$this->textRepo = new FakeTextRepository();
$this->textRepo->create(new CreateTextDto(
name: 'text'
));
$this->nodeRepo = new FakeNodeRepository;
$this->nodeRepo = new FakeNodeRepository();
$this->useCase = new CreateNode(
nodeRepo: $this->nodeRepo,
textRepo: $this->textRepo,

View file

@ -30,11 +30,11 @@ class CreatePlanTest extends TestCase
public function setUp(): void
{
$this->planRepo = new FakePlanRepository;
$this->userRepo = new FakeUserRepository;
$this->textRepo = new FakeTextRepository;
$this->nodeRepo = new FakeNodeRepository;
$this->scheduledNodeRepo = new FakeScheduledNodeRepository;
$this->planRepo = new FakePlanRepository();
$this->userRepo = new FakeUserRepository();
$this->textRepo = new FakeTextRepository();
$this->nodeRepo = new FakeNodeRepository();
$this->scheduledNodeRepo = new FakeScheduledNodeRepository();
$this->userRepo->create(new CreateUserDto(
email: new EmailAddress('test@test.com'),
));
@ -121,7 +121,8 @@ class CreatePlanTest extends TestCase
textId: 0,
));
$this->assertEquals(
1, $this->scheduledNodeRepo->getNumberOfTimesCreateCalled()
1,
$this->scheduledNodeRepo->getNumberOfTimesCreateCalled()
);
}
}

View file

@ -26,8 +26,8 @@ class CreateScheduledNodeTest extends TestCase
public function setUp(): void
{
$this->scheduledNodeRepo = new FakeScheduledNodeRepository;
$this->planRepo = new FakePlanRepository;
$this->scheduledNodeRepo = new FakeScheduledNodeRepository();
$this->planRepo = new FakePlanRepository();
$this->planRepo->create(new CreatePlanDto(
name: 'testplan',
user: new User(0, new EmailAddress('test@test.com')),

View file

@ -20,8 +20,8 @@ class CreateTextTest extends TestCase
protected function setUp(): void
{
$this->textRepo = new FakeTextRepository;
$this->nodeRepo = new FakeNodeRepository;
$this->textRepo = new FakeTextRepository();
$this->nodeRepo = new FakeNodeRepository();
$this->useCase = new CreateText(
$this->textRepo,
$this->nodeRepo,

View file

@ -12,7 +12,7 @@ class CreateUserTest extends TestCase
{
public function test_create_user(): void
{
$userRepo = new FakeUserRepository;
$userRepo = new FakeUserRepository();
$useCase = new CreateUser($userRepo);
$useCase->execute(new CreateUserRequest(
email: 'test@test.com',

View file

@ -23,10 +23,10 @@ class BulkCreateNodesControllerTest extends TestCase
public function setUp(): void
{
$this->textRepo = new FakeTextRepository;
$this->textRepo = new FakeTextRepository();
$text = $this->textRepo->create(new CreateTextDto(name: 'test text'));
$this->nodeRepo = new FakeNodeRepository;
$this->nodeRepo = new FakeNodeRepository();
$this->nodeRepo->create(new CreateNodeDto(
text: $text,
title: 'Root Node',
@ -44,8 +44,8 @@ class BulkCreateNodesControllerTest extends TestCase
private function makeRequest(array $data): ServerRequestInterface
{
$body = (new StreamFactory())->createStream(json_encode($data));
return (new ServerRequestFactory())
$body = new StreamFactory()->createStream(json_encode($data));
return new ServerRequestFactory()
->createServerRequest('POST', 'http://localhost/api/nodes/bulk')
->withHeader('Content-Type', 'application/json')
->withBody($body);

View file

@ -21,10 +21,10 @@ class NodeControllerTest extends TestCase
public function setUp(): void
{
$this->textRepo = new FakeTextRepository;
$this->textRepo = new FakeTextRepository();
$this->textRepo->create(new CreateTextDto(name: 'test text'));
$this->nodeRepo = new FakeNodeRepository;
$this->nodeRepo = new FakeNodeRepository();
$this->controller = new NodeController($this->nodeRepo, $this->textRepo);
}
@ -93,12 +93,12 @@ class NodeControllerTest extends TestCase
parentNode: null,
));
$body = (new StreamFactory())->createStream(json_encode([
$body = new StreamFactory()->createStream(json_encode([
'textId' => 0,
'title' => 'Child Node',
'parentNodeId' => $rootNode->getId(),
]));
$request = (new ServerRequestFactory())
$request = new ServerRequestFactory()
->createServerRequest('POST', 'http://localhost/api/nodes')
->withHeader('Content-Type', 'application/json')
->withBody($body);
@ -118,11 +118,11 @@ class NodeControllerTest extends TestCase
public function test_create_node_returns_400_when_title_missing(): void
{
$body = (new StreamFactory())->createStream(json_encode([
$body = new StreamFactory()->createStream(json_encode([
'textId' => 0,
'parentNodeId' => null,
]));
$request = (new ServerRequestFactory())
$request = new ServerRequestFactory()
->createServerRequest('POST', 'http://localhost/api/nodes')
->withHeader('Content-Type', 'application/json')
->withBody($body);
@ -138,12 +138,12 @@ class NodeControllerTest extends TestCase
public function test_create_node_returns_404_when_text_not_found(): void
{
$body = (new StreamFactory())->createStream(json_encode([
$body = new StreamFactory()->createStream(json_encode([
'textId' => 99,
'title' => 'Some Node',
'parentNodeId' => null,
]));
$request = (new ServerRequestFactory())
$request = new ServerRequestFactory()
->createServerRequest('POST', 'http://localhost/api/nodes')
->withHeader('Content-Type', 'application/json')
->withBody($body);

View file

@ -19,7 +19,7 @@ class TextControllerTest extends TestCase
public function setUp(): void
{
$this->textRepo = new FakeTextRepository;
$this->textRepo = new FakeTextRepository();
$this->textRepo->create(new CreateTextDto(
name: 'test text',
));
@ -56,7 +56,7 @@ class TextControllerTest extends TestCase
[
'id' => 1,
'name' => 'test text 2',
]
],
]),
$response->getBody()
);
@ -64,7 +64,7 @@ class TextControllerTest extends TestCase
public function test_create_text(): void
{
$request = (new ServerRequestFactory())
$request = new ServerRequestFactory()
->createServerRequest('POST', 'http://localhost/texts')
->withParsedBody(['name' => 'my new text']);
@ -73,7 +73,7 @@ class TextControllerTest extends TestCase
new Response(),
new CreateText(
$this->textRepo,
new FakeNodeRepository,
new FakeNodeRepository(),
),
);
$this->assertEquals(