diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index c726237de..0350f1b2a 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -132,6 +132,11 @@ jobs:
wget https://github.com/wkhtmltopdf/packaging/releases/download/${{ matrix.wkhtmltopdf }}/wkhtmltox_${{ matrix.wkhtmltopdf }}.jammy_amd64.deb
sudo dpkg -i wkhtmltox_${{ matrix.wkhtmltopdf }}.jammy_amd64.deb
+ -
+ name: Ensure wkhtmltopdf is executable
+ if: matrix.wkhtmltopdf != false
+ run: chmod +x /usr/local/bin/wkhtmltopdf
+
-
name: Output PHP version for Symfony CLI
run: php -v | head -n 1 | awk '{ print $2 }' > .php-version
diff --git a/.gitignore b/.gitignore
index 9117e715e..42eaa5c8b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@ tests/Application/node_modules/
/tests/TestApplication/.env.local
/tests/TestApplication/.env.*.local
+/var/
phpspec.yml
diff --git a/features/refunding_single_order_unit.feature b/features/refunding_single_order_unit.feature
index 299d0fe92..851cf208f 100644
--- a/features/refunding_single_order_unit.feature
+++ b/features/refunding_single_order_unit.feature
@@ -47,7 +47,7 @@ Feature: Refunding a single order unit
@ui
Scenario: Not being able to refund unit from an order that is unpaid
When I am viewing the summary of the order "#00000022"
- Then I should see disabled refunds button
+ Then I should not see refunds button
@application
Scenario: Not being able to refund unit from an order that is unpaid
diff --git a/templates/admin/order/content/header/title_block/actions/refunds.html.twig b/templates/admin/order/content/header/title_block/actions/refunds.html.twig
index 10762014a..381782caa 100644
--- a/templates/admin/order/content/header/title_block/actions/refunds.html.twig
+++ b/templates/admin/order/content/header/title_block/actions/refunds.html.twig
@@ -1,7 +1,10 @@
{% set order = hookable_metadata.context.resource %}
-{% set path = path('sylius_refund_order_refunds_list', {'orderNumber': order.number,}) %}
-
- {{ ux_icon('tabler:repeat', {'class': 'icon dropdown-item-icon'}) }}
- {{ 'sylius_refund.ui.refunds'|trans }}
-
+{% if can_refund_order(order.number) %}
+ {% set path = path('sylius_refund_order_refunds_list', {'orderNumber': order.number,}) %}
+
+
+ {{ ux_icon('tabler:repeat', {'class': 'icon dropdown-item-icon'}) }}
+ {{ 'sylius_refund.ui.refunds'|trans }}
+
+{% endif %}
diff --git a/tests/Behat/Context/Ui/ManagingOrdersContext.php b/tests/Behat/Context/Ui/ManagingOrdersContext.php
index a5033c882..e2e3ca389 100644
--- a/tests/Behat/Context/Ui/ManagingOrdersContext.php
+++ b/tests/Behat/Context/Ui/ManagingOrdersContext.php
@@ -33,9 +33,7 @@ public function shouldBeNotifiedThatTheOrderShouldBePaid(): void
);
}
- /**
- * @Then I should not see refunds button
- */
+ #[Then('I should not see refunds button')]
public function iShouldNotSeeRefundsButton(): void
{
Assert::false($this->showPage->hasRefundsButton());
diff --git a/tests/Behat/Page/Admin/Order/ShowPage.php b/tests/Behat/Page/Admin/Order/ShowPage.php
index 69e06d5dd..71024b830 100644
--- a/tests/Behat/Page/Admin/Order/ShowPage.php
+++ b/tests/Behat/Page/Admin/Order/ShowPage.php
@@ -37,7 +37,7 @@ public function hasDownloadCreditMemoButton(int $index): bool
public function hasRefundsButton(): bool
{
- return $this->getDocument()->hasButton('Refunds');
+ return $this->getDocument()->has('css', '[data-test-refunds]');
}
public function hasDisabledRefundsButton(): bool
diff --git a/tests/TestApplication/config/config.yaml b/tests/TestApplication/config/config.yaml
index 18c891fe6..cd2d45697 100644
--- a/tests/TestApplication/config/config.yaml
+++ b/tests/TestApplication/config/config.yaml
@@ -5,3 +5,9 @@ imports:
twig:
paths:
'%kernel.project_dir%/../../../tests/TestApplication/templates': ~
+
+knp_snappy:
+ pdf:
+ enabled: true
+ binary: '%env(resolve:WKHTMLTOPDF_PATH)%'
+ options: []