php cs fixer
This commit is contained in:
parent
26abaeb739
commit
189493b045
17 changed files with 44 additions and 43 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue