Skip to content

Commit

Permalink
tests now send proper booleans to endpoints instead of strings and ints
Browse files Browse the repository at this point in the history
  • Loading branch information
eceltov committed Feb 28, 2025
1 parent 74c55a7 commit f9d4ca3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions tests/Presenters/CommentsPresenter.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class TestCommentsPresenter extends Tester\TestCase
'V1:Comments',
'POST',
['action' => 'addComment', 'id' => '6b89a6df-f7e8-4c2c-a216-1b7cb4391647'], // mainThread
['text' => 'some comment text', 'isPrivate' => 'false']
['text' => 'some comment text', 'isPrivate' => false]
);
$response = $this->presenter->run($request);
Assert::type(Nette\Application\Responses\JsonResponse::class, $response);
Expand Down Expand Up @@ -141,7 +141,7 @@ class TestCommentsPresenter extends Tester\TestCase
'V1:Comments',
'POST',
['action' => 'addComment', 'id' => $assignmentSolution->getId()],
['text' => 'some comment text', 'isPrivate' => 'false']
['text' => 'some comment text', 'isPrivate' => false]
);
$response = $this->presenter->run($request);
Assert::type(Nette\Application\Responses\JsonResponse::class, $response);
Expand Down Expand Up @@ -172,7 +172,7 @@ class TestCommentsPresenter extends Tester\TestCase
'V1:Comments',
'POST',
['action' => 'addComment', 'id' => $referenceSolution->getId()],
['text' => 'some comment text', 'isPrivate' => 'false']
['text' => 'some comment text', 'isPrivate' => false]
);
$response = $this->presenter->run($request);
Assert::type(Nette\Application\Responses\JsonResponse::class, $response);
Expand Down Expand Up @@ -202,7 +202,7 @@ class TestCommentsPresenter extends Tester\TestCase
'V1:Comments',
'POST',
['action' => 'addComment', 'id' => $assignment->getId()],
['text' => 'some comment text', 'isPrivate' => 'false']
['text' => 'some comment text', 'isPrivate' => false]
);
$response = $this->presenter->run($request);
Assert::type(Nette\Application\Responses\JsonResponse::class, $response);
Expand All @@ -226,7 +226,7 @@ class TestCommentsPresenter extends Tester\TestCase
'V1:Comments',
'POST',
['action' => 'addComment', 'id' => '5d45dcd0-50e7-4b2a-a291-cfe4b5fb5cbb'], // dummy thread (nonexist)
['text' => 'some comment text', 'isPrivate' => 'false']
['text' => 'some comment text', 'isPrivate' => false]
);
$response = $this->presenter->run($request);
Assert::type(Nette\Application\Responses\JsonResponse::class, $response);
Expand Down
6 changes: 3 additions & 3 deletions tests/Presenters/ExercisesPresenter.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ class TestExercisesPresenter extends Tester\TestCase
'V1:Exercises',
'POST',
['action' => 'setArchived', 'id' => $exercise->getId()],
['archived' => 'true']
['archived' => true]
);

$this->presenter->exercises->refresh($exercise);
Expand All @@ -1002,7 +1002,7 @@ class TestExercisesPresenter extends Tester\TestCase
'V1:Exercises',
'POST',
['action' => 'setArchived', 'id' => $exercise->getId()],
['archived' => 'true']
['archived' => true]
);
},
ForbiddenRequestException::class
Expand All @@ -1022,7 +1022,7 @@ class TestExercisesPresenter extends Tester\TestCase
'V1:Exercises',
'POST',
['action' => 'setArchived', 'id' => $exercise->getId()],
['archived' => 'false']
['archived' => false]
);

$this->presenter->exercises->refresh($exercise);
Expand Down
8 changes: 4 additions & 4 deletions tests/Presenters/InstancesPresenter.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class TestInstancesPresenter extends Tester\TestCase
'V1:Instances',
'POST',
['action' => 'createInstance'],
['name' => 'NIOT', 'description' => 'Just a new instance', 'isOpen' => 'true']
['name' => 'NIOT', 'description' => 'Just a new instance', 'isOpen' => true]
);
$response = $this->presenter->run($request);
Assert::type(Nette\Application\Responses\JsonResponse::class, $response);
Expand All @@ -121,7 +121,7 @@ class TestInstancesPresenter extends Tester\TestCase
'V1:Instances',
'POST',
['action' => 'updateInstance', 'id' => $instance->getId()],
['isOpen' => 'false']
['isOpen' => false]
);
$response = $this->presenter->run($request);
Assert::type(Nette\Application\Responses\JsonResponse::class, $response);
Expand All @@ -143,7 +143,7 @@ class TestInstancesPresenter extends Tester\TestCase
'V1:Instances',
'POST',
['action' => 'createInstance'],
['name' => 'NIOT', 'description' => 'Just a new instance', 'isOpen' => 'true']
['name' => 'NIOT', 'description' => 'Just a new instance', 'isOpen' => true]
);
$response = $this->presenter->run($request);
$newInstanceId = $response->getPayload()['payload']['id'];
Expand Down Expand Up @@ -225,7 +225,7 @@ class TestInstancesPresenter extends Tester\TestCase
'V1:Instances',
'POST',
['action' => 'updateLicence', 'licenceId' => $newLicence->getId()],
['note' => 'Changed description', 'validUntil' => '2020-01-01 13:02:56', 'isValid' => 'false']
['note' => 'Changed description', 'validUntil' => '2020-01-01 13:02:56', 'isValid' => false]
);
$response = $this->presenter->run($request);
Assert::type(Nette\Application\Responses\JsonResponse::class, $response);
Expand Down
2 changes: 1 addition & 1 deletion tests/Presenters/UsersPresenter.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ class TestUsersPresenter extends Tester\TestCase
$this->presenterPath,
'POST',
['action' => 'setAllowed', 'id' => $user->getId()],
['isAllowed' => 0]
['isAllowed' => false]
);

Assert::same($user->getId(), $payload['id']);
Expand Down

0 comments on commit f9d4ca3

Please sign in to comment.