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

Update dependencies #52

Merged
merged 2 commits into from
Sep 4, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
pull_request:

env:
PHP_VERSION: 8.1
PHP_VERSION: 8.3

jobs:
composer-require-checker:
name: Check missing composer requirements
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Konfiguriere PHP-Version und -Einstellungen im Worker-Node
Expand All @@ -35,4 +35,4 @@ jobs:
composer require webfactory/http-cache-bundle
composer show
- name: ComposerRequireChecker
uses: docker://ghcr.io/webfactory/composer-require-checker:4.8.0
uses: docker://ghcr.io/webfactory/composer-require-checker:4.12.0
2 changes: 1 addition & 1 deletion .github/workflows/fix-cs-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Coding Standards
jobs:
open-pr-for-cs-violations:
name: PHP-CS-Fixer
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- name: Checkout code
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ env:

jobs:
PHPUnit:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { php-version: 8.1, symfony-locked-version: none, dependency-version: prefer-lowest }
- { php-version: 8.2, symfony-locked-version: 5.4.*, dependency-version: prefer-stable }
- { php-version: 8.2, symfony-locked-version: 6.4.*, dependency-version: prefer-stable }
- { php-version: 8.3, symfony-locked-version: none, dependency-version: prefer-stable }
name: PHPUnit (PHP ${{matrix.php-version}}, Symfony Version Lock ${{ matrix.symfony-locked-version }}, ${{ matrix.dependency-version }})
Expand Down
Empty file.
50 changes: 27 additions & 23 deletions Tests/Util/CriticalSectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Webfactory\Bundle\WfdMetaBundle\Tests\Util;

use Closure;
use PHPUnit\Framework\TestCase;
use stdClass;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\Store\FlockStore;
use Webfactory\Bundle\WfdMetaBundle\Util\CriticalSection;
Expand Down Expand Up @@ -48,39 +46,45 @@ public function testExecuteReturnsValueFromCallback()

public function testInvokesCallbacksWithDifferentLocks()
{
$this->criticalSection->execute(__DIR__.'/my/virtual/file1', $this->createCallbackThatMustBeInvoked());
$this->criticalSection->execute(__DIR__.'/my/virtual/file2', $this->createCallbackThatMustBeInvoked());
$invoked = false;

$this->criticalSection->execute(__DIR__.'/my/virtual/file1', function () use (&$invoked) {
$invoked = true;
});
$this->criticalSection->execute(__DIR__.'/my/virtual/file2', function () use (&$invoked) {
$invoked = true;
});

self::assertTrue($invoked);
}

public function testInvokesCallbackWithSameLock()
{
$this->criticalSection->execute(__DIR__.'/my/virtual/file1', $this->createCallbackThatMustBeInvoked());
$this->criticalSection->execute(__DIR__.'/my/virtual/file1', $this->createCallbackThatMustBeInvoked());
$invoked = false;

$this->criticalSection->execute(__DIR__.'/my/virtual/file1', function () use (&$invoked) {
$invoked = true;
});
$this->criticalSection->execute(__DIR__.'/my/virtual/file1', function () use (&$invoked) {
$invoked = true;
});

self::assertTrue($invoked);
}

/**
* This ensures that the critical section is re-entrant as documented.
*/
public function testCallbackCanAcquireSameLockAgain()
{
$this->criticalSection->execute(__DIR__.'/my/virtual/file1', function () {
$this->criticalSection->execute(__DIR__.'/my/virtual/file1', $this->createCallbackThatMustBeInvoked());
});
}
$invoked = false;

/**
* Creates a closure that must be called, otherwise the test fails.
*
* @return Closure
*/
private function createCallbackThatMustBeInvoked()
{
$mock = $this->getMockBuilder(stdClass::class)->setMethods(['__invoke'])->getMock();
$mock->expects($this->once())
->method('__invoke');
$this->criticalSection->execute(__DIR__.'/my/virtual/file1', function () use (&$invoked) {
$this->criticalSection->execute(__DIR__.'/my/virtual/file1', function () use (&$invoked) {
$invoked = true;
});
});

return function () use ($mock) {
\call_user_func($mock);
};
self::assertTrue($invoked);
}
}
30 changes: 15 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@

"require": {
"php": ">= 8.1",
"doctrine/dbal": "^2.12|^3.0",
"doctrine/orm": "^2.0",
"doctrine/persistence": "^1.3|^2.1|^3.0",
"doctrine/dbal": "^2.13|^3.0",
"doctrine/orm": "^2.8|^3.0",
"doctrine/persistence": "^2.1|^3.0",
"psr/container": "^1.0",
"psr/log": "^1.0",
"symfony/config": "^5.1|^6.0|^7.0",
"symfony/service-contracts": "^1.0|^2.0|^3.0",
"symfony/dependency-injection": "^5.1|^6.0|^7.0",
"symfony/filesystem": "^5.1|^6.0|^7.0",
"symfony/finder": "^5.1|^6.0|^7.0",
"symfony/http-foundation": "^5.1|^6.0|^7.0",
"symfony/http-kernel": "^5.1|^6.0|^7.0",
"symfony/lock": "^5.1|^6.0|^7.0",
"symfony/twig-bundle": "^5.1|^6.0|^7.0",
"twig/twig": "^1.0|^2.0|^3.0"
"psr/log": "^1|^2|^3",
"symfony/config": "^5.4|^6.4|^7.0",
"symfony/service-contracts": "^2.5|^3.0",
"symfony/dependency-injection": "^5.4|^6.4|^7.0",
"symfony/filesystem": "^5.4|^6.4|^7.0",
"symfony/finder": "^5.4|^6.4|^7.0",
"symfony/http-foundation": "^5.4|^6.4|^7.0",
"symfony/http-kernel": "^5.4|^6.4|^7.0",
"symfony/lock": "^5.4|^6.4|^7.0",
"symfony/twig-bundle": "^5.4|^6.4|^7.0",
"twig/twig": "^2.0|^3.0"
},

"suggest": {
"webfactory/http-cache-bundle": "If you want to use wfd_meta information to determine Last-Modified information for requests"
},

"require-dev": {
"phpunit/phpunit": "^9.6.18",
"phpunit/phpunit": "^9.6.18|^10.5",
"symfony/phpunit-bridge": ">=7.0"
},

Expand Down
26 changes: 6 additions & 20 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
bootstrap="vendor/autoload.php">

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="Full test suite">
<directory>Tests</directory>
</testsuite>
</testsuites>

<!-- Filter for code coverage -->
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">.</directory>
<exclude>
<directory>Resources</directory>
<directory>Tests</directory>
<directory>vendor</directory>
</exclude>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
<php>
<ini name="error_reporting" value="-1" />
<server name="SHELL_VERBOSITY" value="-1" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
</php>
</phpunit>
Loading