Skip to content

Commit c5a1df3

Browse files
committed
Fixed tests
1 parent 46d1a0c commit c5a1df3

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/Controller/LabelController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ public function generator(Request $request, ?LabelProfile $profile = null): Resp
147147
]);
148148
}
149149

150-
if ($form->get('update_profile')->isClicked() && $profile instanceof LabelProfile && $this->isGranted('edit', $profile)) { //@phpstan-ignore-line Phpstan does not recognize the isClicked method
150+
//Check if the current profile should be updated
151+
if ($form->has('update_profile')
152+
&& $form->get('update_profile')->isClicked() //@phpstan-ignore-line Phpstan does not recognize the isClicked method
153+
&& $profile instanceof LabelProfile
154+
&& $this->isGranted('edit', $profile)) {
151155
//Update the profile options
152156
$profile->setOptions($form_options);
153157

templates/label_system/dialog.html.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@
100100
</div>
101101
{% endif %}
102102

103-
{{ form_row(form.update_profile) }}
103+
{% if form.update_profile is defined %}
104+
{{ form_row(form.update_profile) }}
105+
{% endif %}
104106

105107
<div class="form-group row">
106108
<div class="offset-sm-3 col-sm-9">

tests/API/Endpoints/CurrencyEndpointTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testGetCollection(): void
3636
{
3737
$this->_testGetCollection();
3838
self::assertJsonContains([
39-
'hydra:totalItems' => 0,
39+
'hydra:totalItems' => 4, //The 4 currencies from our fixtures
4040
]);
4141
}
4242

@@ -45,7 +45,7 @@ public function testCreateItem(): void
4545
{
4646
$this->_testPostItem([
4747
'name' => 'Test API',
48-
'iso_code' => 'USD',
48+
'iso_code' => 'CAD',
4949
]);
5050
}
5151

@@ -61,4 +61,4 @@ public function testDeleteItem(): void
6161
{
6262
$this->_testDeleteItem(5);
6363
}*/
64-
}
64+
}

0 commit comments

Comments
 (0)