From c116aea47525f2412d54430088c81fa93b0f045b Mon Sep 17 00:00:00 2001 From: Erik van der Bas Date: Tue, 21 May 2024 18:44:58 +0200 Subject: [PATCH] Chore: fix tests, update pr template and update CI (#163) * fix: Move PR template to proper directory * fix: fix unit test * chore: update actions to latest versions --- .github/{workflows => }/PULL_REQUEST_TEMPLATE.md | 0 .github/workflows/test.yml | 4 ++-- .gitignore | 1 + ...imberStarterTheme.php => test-timber-starter-theme.php} | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) rename .github/{workflows => }/PULL_REQUEST_TEMPLATE.md (100%) rename tests/{TestTimberStarterTheme.php => test-timber-starter-theme.php} (81%) diff --git a/.github/workflows/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/workflows/PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bcd1b32dc..f949e1e7a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,7 +53,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -68,7 +68,7 @@ jobs: - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - uses: ramsey/composer-install@v2 + - uses: ramsey/composer-install@v3 - name: Run tests run: composer run test diff --git a/.gitignore b/.gitignore index 1bb6bab50..9477bf3a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /composer.lock /vendor/ /wordpress/ +.phpunit.result.cache \ No newline at end of file diff --git a/tests/TestTimberStarterTheme.php b/tests/test-timber-starter-theme.php similarity index 81% rename from tests/TestTimberStarterTheme.php rename to tests/test-timber-starter-theme.php index 33a6651ae..5d8b06c7f 100644 --- a/tests/TestTimberStarterTheme.php +++ b/tests/test-timber-starter-theme.php @@ -31,13 +31,13 @@ function testTimberExists() { function testFunctionsPHP() { $context = Timber::context(); - $this->assertEquals('StarterSite', get_class($context['site'])); + $this->assertEquals('App\StarterSite', get_class($context['site'])); $this->assertTrue(current_theme_supports('post-thumbnails')); $this->assertEquals('bar', $context['foo']); } function testLoading() { - $str = Timber::compile('tease.twig'); + $str = Timber::compile('partials/tease.twig'); $this->assertStringStartsWith('
', $str); $this->assertStringEndsWith('
', $str); } @@ -46,7 +46,8 @@ function testLoading() { * Helper test to output current twig version */ function testTwigVersion() { - // $version = Timber::compile_string("{{ version }}", [ 'version', Twig\Environment::VERSION ]); + $version = Timber::compile_string("{{ version }}", [ 'version' => Twig\Environment::VERSION ]); + $this->assertEquals(Twig\Environment::VERSION, $version); } function testTwigFilter() {