Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ jobs:
fail-fast: true
matrix:
php: [8.2, 8.3, 8.4]
phpunit: ['10.5.35', '11.5.3', '12.0.0']
phpunit: ['10.5.35', '11.5.3', '12.0.0', '12.1.0']
stability: [prefer-lowest, prefer-stable]
exclude:
- php: 8.2
phpunit: '12.0.0'
- php: 8.2
phpunit: '12.1.0'

name: PHP ${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} - ${{ matrix.stability }}

Expand Down Expand Up @@ -72,7 +74,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --with="phpunit/phpunit:^${{ matrix.phpunit }}"
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --with="phpunit/phpunit:~${{ matrix.phpunit }}"

- name: Execute tests
run: vendor/bin/phpunit --display-deprecation ${{ matrix.stability == 'prefer-stable' && '--fail-on-deprecation' || '' }}
Expand All @@ -99,11 +101,13 @@ jobs:
fail-fast: true
matrix:
php: [8.2, 8.3, 8.4]
phpunit: ['11.5.3']
phpunit: ['10.5.35', '11.5.3', '12.0.0', '12.1.0']
stability: [prefer-lowest, prefer-stable]
exclude:
- php: 8.4
stability: prefer-lowest
- php: 8.2
phpunit: '12.0.0'
- php: 8.2
phpunit: '12.1.0'

name: PHP ${{ matrix.php }} - PHPUnit ${{ matrix.phpunit }} - ${{ matrix.stability }} - Windows

Expand Down Expand Up @@ -132,7 +136,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --with="phpunit/phpunit:^${{ matrix.phpunit }}"
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --with="phpunit/phpunit:~${{ matrix.phpunit }}"

- name: Execute tests
run: vendor/bin/phpunit
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"pda/pheanstalk": "^5.0.6",
"php-http/discovery": "^1.15",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^10.5.35|^11.5.3|~12.0.1",
"phpunit/phpunit": "^10.5.35|^11.5.3|^12.0.1",
"predis/predis": "^2.3",
"resend/resend-php": "^0.10.0",
"symfony/cache": "^7.2.0",
Expand Down
22 changes: 16 additions & 6 deletions tests/Integration/View/BladeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;

use function Orchestra\Testbench\artisan;
use function Orchestra\Testbench\phpunit_version_compare;

class BladeTest extends TestCase
{
/** {@inheritdoc} */
#[\Override]
protected function tearDown(): void
{
artisan($this, 'view:clear');

parent::tearDown();
}

public function test_rendering_blade_string()
{
$this->assertSame('Hello Taylor', Blade::render('Hello {{ $name }}', ['name' => 'Taylor']));
Expand All @@ -33,8 +45,8 @@ public function test_rendering_blade_long_maxpathlen_string_with_exact_length()
// The PHP_MAXPATHLEN restriction is only active, if
// open_basedir is set and active. Otherwise, the check
// for the PHP_MAXPATHLEN is not active.
if (ini_get('open_basedir') === '') {
$openBaseDir = windows_os() ? explode('\\', __DIR__)[0].'\\'.';'.sys_get_temp_dir() : '/';
if (ini_get('open_basedir') === '' && phpunit_version_compare('12.1.0', '<')) {
$openBaseDir = explode(DIRECTORY_SEPARATOR, __DIR__)[0].DIRECTORY_SEPARATOR.PATH_SEPARATOR.sys_get_temp_dir();
$iniSet = ini_set(
'open_basedir',
$openBaseDir
Expand Down Expand Up @@ -197,19 +209,17 @@ public function test_bound_name_attribute_can_be_used_if_using_short_slot_names_

public function testViewCacheCommandHandlesConfiguredBladeExtensions()
{
$this->artisan('view:clear');

View::addExtension('sh', 'blade');
$this->artisan('view:cache');

$compiledFiles = Finder::create()->in(Config::get('view.compiled'))->files();
$found = collect($compiledFiles)
->contains(fn (SplFileInfo $file) => str_contains($file->getContents(), 'echo "<?php echo e($scriptMessage); ?>" > output.log'));
$this->assertTrue($found);

$this->artisan('view:clear');
}

/** {@inheritdoc} */
#[\Override]
protected function defineEnvironment($app)
{
$app['config']->set('view.paths', [__DIR__.'/templates']);
Expand Down
Loading