Skip to content

Commit

Permalink
feature Sylius#13912 Support Twig 3 (Zales0123)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.12-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | 
| License         | MIT

I was wondering, is it worth running builds on both Twig 2 and 3 🤔 But we already have a lot of them, so I decided to skip it for now. Maybe we should have one additional build with Twig 2 (as with the current `composer update` we will always use Twig 3)? 🤷‍♂️ Nevertheless, it's nice we can finally support Twig 3 🖖 

Commits
-------

5a4c8d9 Support Twig 3
6792c7a Additional build with Twig 2
  • Loading branch information
GSadee authored May 4, 2022
2 parents 548848e + 6792c7a commit ed14520
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
name: Run PHPStan
run: vendor/bin/phpstan analyse
if: always() && steps.end-of-setup.outcome == 'success'

-
name: Run ComposerRequireChecker
run: |
Expand Down Expand Up @@ -394,7 +394,7 @@ jobs:
test-application-without-frontend-mysql:
runs-on: ubuntu-latest

name: "Test non-JS application (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }})"
name: "Test non-JS application (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }})"

timeout-minutes: 25

Expand All @@ -405,6 +405,14 @@ jobs:
symfony: ["^5.4"]
node: ["14.x", "16.x"]
mysql: ["5.7", "8.0"]
twig: ["3.x"]
include:
-
php: "8.0"
symfony: "^5.4"
node: "14.x"
twig: "2.x"
mysql: "5.7"

env:
APP_ENV: test_cached
Expand Down Expand Up @@ -456,6 +464,12 @@ jobs:
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-
-
name: Restrict Twig version
if: matrix.twig != ''
run: |
composer require "twig/twig:${{ matrix.twig }}" --no-update --no-scripts --no-interaction
-
name: Install PHP dependencies
run: composer update --no-interaction --no-scripts
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"symfony/validator": "^5.4",
"symfony/yaml": "^5.4",
"twig/intl-extra": "^2.12",
"twig/twig": "^2.12",
"twig/twig": "^2.12 || ^3.3",
"webmozart/assert": "^1.9",
"willdurand/hateoas": "^3.0",
"willdurand/hateoas-bundle": "^2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@

use PhpSpec\ObjectBehavior;
use Sylius\Component\Addressing\Model\CountryInterface;
use Twig\Extension\ExtensionInterface;

final class CountryNameExtensionSpec extends ObjectBehavior
{
function it_is_a_twig_extension(): void
{
$this->shouldHaveType(\Twig_Extension::class);
$this->shouldImplement(ExtensionInterface::class);
}

function it_translates_country_iso_code_into_name(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
namespace spec\Sylius\Bundle\UiBundle\Twig;

use PhpSpec\ObjectBehavior;
use Twig\Extension\ExtensionInterface;

final class PercentageExtensionSpec extends ObjectBehavior
{
function it_is_twig_extension(): void
{
$this->shouldHaveType(\Twig_Extension::class);
$this->shouldImplement(ExtensionInterface::class);
}

function it_returns_float_number_as_percentage(): void
Expand Down
3 changes: 2 additions & 1 deletion src/Sylius/Bundle/UiBundle/spec/Twig/SortByExtensionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\UiBundle\spec\Fixtures\SampleInterface;
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
use Twig\Extension\ExtensionInterface;

final class SortByExtensionSpec extends ObjectBehavior
{
function it_extends_twig_extensions(): void
{
$this->shouldHaveType(\Twig_Extension::class);
$this->shouldImplement(ExtensionInterface::class);
}

function it_sorts_in_ascending_order_by_default(
Expand Down

0 comments on commit ed14520

Please sign in to comment.