Skip to content

Commit

Permalink
Merge 1.x into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI authored Jan 24, 2024
2 parents c149164 + 6ae7979 commit eccad2c
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 34 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: none
tools: composer:v2

Expand All @@ -48,12 +48,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: none
tools: composer:v2, composer-normalize:2
env:
Expand All @@ -69,7 +69,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install yamllint
run: sudo apt-get install yamllint
Expand All @@ -84,7 +84,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install required dependencies
run: sudo apt-get update && sudo apt-get install libxml2-utils
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: none
tools: composer:v2

Expand All @@ -48,12 +48,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: none
tools: composer:v2

Expand All @@ -63,7 +63,7 @@ jobs:
dependency-versions: highest

- name: Psalm
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.2
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.3

rector:
name: Rector
Expand All @@ -72,12 +72,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'
coverage: none
tools: composer:v2

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-platforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
matrix:
php-version:
- '8.2'
- '8.3'
mysql-version:
- '5.7'
- '8.0'
Expand All @@ -46,7 +46,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
strategy:
matrix:
php-version:
- '8.2'
- '8.3'
postgres-version:
- '13'
- '14'
Expand All @@ -100,7 +100,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
dependencies: [highest]
allowed-to-fail: [false]
symfony-require: ['']
Expand All @@ -42,47 +43,41 @@ jobs:
dependencies: lowest
allowed-to-fail: false
variant: normal
- php-version: '8.2'
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
symfony-require: 5.4.*
variant: symfony/symfony:"5.4.*"
- php-version: '8.2'
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.3.*
variant: symfony/symfony:"6.3.*"
- php-version: '8.2'
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.4.*
variant: symfony/symfony:"6.4.*"
- php-version: '8.2'
- php-version: '8.3'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.0.*
variant: symfony/symfony:"7.0.*"

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
tools: composer:v2
tools: composer:v2, flex

- name: Add PHPUnit matcher
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Globally install symfony/flex
if: matrix.symfony-require != ''
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins symfony/flex
- name: Install variant
if: matrix.variant != 'normal' && !startsWith(matrix.variant, 'symfony/symfony')
run: composer require ${{ matrix.variant }} --no-update
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ phpstan:
.PHONY: phpstan

psalm:
vendor/bin/psalm --php-version=8.2
vendor/bin/psalm --php-version=8.3
.PHONY: psalm

rector:
Expand Down
25 changes: 21 additions & 4 deletions tests/DependencyInjection/SimpleThingsEntityAuditExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use SimpleThings\EntityAudit\EventListener\CreateSchemaListener;
use SimpleThings\EntityAudit\EventListener\LogRevisionsListener;
use SimpleThings\EntityAudit\User\TokenStorageUsernameCallable;
use Symfony\Component\DependencyInjection\Reference;

final class SimpleThingsEntityAuditExtensionTest extends AbstractExtensionTestCase
{
Expand All @@ -32,25 +33,41 @@ public function testItRegistersDefaultServices(): void
$this->load([]);

$this->assertContainerBuilderHasService('simplethings_entityaudit.manager', AuditManager::class);
$this->assertContainerBuilderHasServiceDefinitionWithArgument('simplethings_entityaudit.manager', 0, 'simplethings_entityaudit.config');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(
'simplethings_entityaudit.manager',
0,
new Reference('simplethings_entityaudit.config')
);

$this->assertContainerBuilderHasService('simplethings_entityaudit.reader', AuditReader::class);
$this->assertContainerBuilderHasServiceDefinitionWithArgument('simplethings_entityaudit.reader', 0);

$this->assertContainerBuilderHasService('simplethings_entityaudit.log_revisions_listener', LogRevisionsListener::class);
$this->assertContainerBuilderHasServiceDefinitionWithArgument('simplethings_entityaudit.log_revisions_listener', 0, 'simplethings_entityaudit.manager');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(
'simplethings_entityaudit.log_revisions_listener',
0,
new Reference('simplethings_entityaudit.manager')
);

foreach ([Events::onFlush, Events::postPersist, Events::postUpdate, Events::postFlush, Events::onClear] as $event) {
$this->assertContainerBuilderHasServiceDefinitionWithTag('simplethings_entityaudit.log_revisions_listener', 'doctrine.event_listener', ['event' => $event, 'connection' => 'default']);
}
$this->assertContainerBuilderHasService('simplethings_entityaudit.create_schema_listener', CreateSchemaListener::class);
$this->assertContainerBuilderHasServiceDefinitionWithArgument('simplethings_entityaudit.create_schema_listener', 0, 'simplethings_entityaudit.manager');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(
'simplethings_entityaudit.create_schema_listener',
0,
new Reference('simplethings_entityaudit.manager')
);
foreach ([ToolEvents::postGenerateSchemaTable, ToolEvents::postGenerateSchema] as $event) {
$this->assertContainerBuilderHasServiceDefinitionWithTag('simplethings_entityaudit.create_schema_listener', 'doctrine.event_listener', ['event' => $event, 'connection' => 'default']);
}

$this->assertContainerBuilderHasService('simplethings_entityaudit.username_callable.token_storage', TokenStorageUsernameCallable::class);
$this->assertContainerBuilderHasServiceDefinitionWithArgument('simplethings_entityaudit.username_callable.token_storage', 0, 'security.token_storage');
$this->assertContainerBuilderHasServiceDefinitionWithArgument(
'simplethings_entityaudit.username_callable.token_storage',
0,
new Reference('security.token_storage')
);

$this->assertContainerBuilderHasService('simplethings_entityaudit.config', AuditConfiguration::class);
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall('simplethings_entityaudit.config', 'setAuditedEntityClasses', ['%simplethings.entityaudit.audited_entities%']);
Expand Down

0 comments on commit eccad2c

Please sign in to comment.