Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs with latest plugin release 1.21.0 #2658

Merged
merged 12 commits into from
Nov 4, 2022
18 changes: 17 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,24 @@ jobs:
dependency-version: 'prefer-stable'
multisite: '0'
experimental: false
# PHP 8.0 / Lowest dependencies
- php: '8.0'
wp: 'latest'
dependency-version: 'prefer-lowest'
multisite: '0'
experimental: false
# PHP 8.1
- php: '8.1'
wp: 'latest'
dependency-version: 'prefer-stable'
multisite: '0'
experimental: false
# PHP 8.1 / Lowest dependencies
- php: '8.1'
wp: 'latest'
dependency-version: 'prefer-lowest'
multisite: '0'
experimental: false
# PHP with Imagick
- php: '7.4'
wp: 'latest'
Expand Down Expand Up @@ -116,7 +128,7 @@ jobs:

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v2
Expand All @@ -133,6 +145,10 @@ jobs:
if: ${{ matrix.wp < '5.9' }}
run: composer req phpunit/phpunit:^7.5 yoast/wp-test-utils:^1.0 -W --dev

- name: Upgrade PHPUnit to ^9.0 when prefer lowest and PHP 8.0+
if: ${{ matrix.dependency-version == 'prefer-lowest' && matrix.php >= '8.0' }}
run: composer req phpunit/phpunit:^9.0 yoast/wp-test-utils:^1.0 -W --dev

- name: Install tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true

Expand Down
8 changes: 7 additions & 1 deletion bin/deploy-to-wp-org.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ function deploy () {
git clone git@github.com:Upstatement/timber-starter-theme.git
rm -rf ~/Sites/timber/timber-starter-theme/.git
rm composer.lock
composer config platform.php 5.6.20

# Download dependencies for the maximum compatible PHP version.
composer config platform.php 8.0
gchtr marked this conversation as resolved.
Show resolved Hide resolved
composer install --no-dev --optimize-autoloader

# Install the lowest compatible version of Twig.
composer update twig/twig:1.44.7 --no-dev

rm -rf ~/Sites/timber/vendor/upstatement/routes/.git
cd ~/Sites/timber-wp
mkdir tags/$1
Expand Down
1 change: 1 addition & 0 deletions bin/timber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Version: 1.21.0
Author URI: http://upstatement.com/
Requires PHP: 7.2.5
Requires at least: 5.3.0
*/
// we look for Composer files first in the plugins dir.
// then in the wp-content dir (site install).
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"require": {
"php": ">=7.2.5 || ^8.0",
"twig/twig": "^1.44 || ^2.10",
"twig/twig": ">=1.44.7 || ^2.10",
"upstatement/routes": "^0.9",
"composer/installers": "^1.0 || ^2.0",
"twig/cache-extension": "^1.5"
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== Timber ===
Contributors: jarednova
Tags: template engine, templates, twig
Requires at least: 4.9.8
Tested up to: 6.0.0
Stable tag: 1.21.0
Requires PHP: 7.2.5
Requires at least: 5.3.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -38,6 +38,12 @@ _Twig is the template language powering Timber; if you need a little background

**Fixes and improvements**

= 1.22.0 =

* Fixed included Twig version. In the plugin version 1.21.0 of Timber, Twig version 2.15.3 was accidentally included instead of Twig version 1.44.7.
* Removed official support for PHP 8.1 in the plugin version. If you need to support PHP 8.1 in the future, please install [Timber through Composer](https://timber.github.io/docs/getting-started/setup/#via-github-for-developers) instead of installing Timber as a plugin. This will the only supported way of installing Timber when Timber version 2 will be released.
* Updated minimum required WordPress version to 5.3.

= 1.21.0 =

* Updated minimum required PHP version to 7.2 to make the included Twig version support PHP 8.0 and 8.1, by @gchtr in #2640.
Expand Down
4 changes: 2 additions & 2 deletions tests/assets/test-shortcodes.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% filter shortcodes %}
{% apply shortcodes %}
hello [timber_shortcode foo]
{% endfilter %}
{% endapply %}
6 changes: 4 additions & 2 deletions tests/test-timber-loader.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?php

use Twig\Loader\LoaderInterface;

class TestTimberLoader extends Timber_UnitTestCase {

function testTwigLoaderFilter() {
$php_unit = $this;
add_filter('timber/loader/loader', function ($loader) use ($php_unit) {
$php_unit->assertInstanceOf('Twig_LoaderInterface', $loader);
$php_unit->assertInstanceOf(LoaderInterface::class, $loader);
return $loader;
});
$str = Timber::compile('assets/single.twig', array());
}

function testBogusTemplate() {
$str = Timber::compile('assets/darkhelmet.twig');
$this->assertFalse($str);
Expand Down