Skip to content

Commit

Permalink
Bump tools and CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Apr 28, 2022
1 parent de0b63c commit e852250
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@1.1.1"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@1.4.1"
7 changes: 6 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- "7.3"
- "7.4"
- "8.0"
- "8.1"
dependencies:
- "highest"
stability:
Expand All @@ -45,7 +46,7 @@ jobs:
php-version: "7.3"
- dependencies: "highest"
stability: "dev"
php-version: "8.0"
php-version: "8.1"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -83,6 +84,10 @@ jobs:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist"

- name: "Configure deprecations helper"
run: "echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV"
if: "${{ matrix.dependencies == 'lowest' }}"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ on:
jobs:
release:
name: "Git tag, release & create merge-up PR"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@1.1.1"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@1.4.1"
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ on:

jobs:
static-analysis:
uses: "doctrine/.github/.github/workflows/static-analysis.yml@1.1.1"
uses: "doctrine/.github/.github/workflows/static-analysis.yml@1.4.1"
with:
php-version: "8.1"
39 changes: 23 additions & 16 deletions Tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand;
use Doctrine\Bundle\FixturesBundle\DependencyInjection\CompilerPass\FixturesCompilerPass;
use Doctrine\Bundle\FixturesBundle\DependencyInjection\CompilerPass\PurgerFactoryCompilerPass;
use Doctrine\Bundle\FixturesBundle\Loader\SymfonyFixturesLoader;
use Doctrine\Bundle\FixturesBundle\Purger\PurgerFactory;
use Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\DependentOnRequiredConstructorArgsFixtures;
use Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\OtherFixtures;
Expand Down Expand Up @@ -121,12 +122,12 @@ public function testExceptionWithDependenciesWithRequiredArguments(): void
$kernel->boot();
$container = $kernel->getContainer();

$this->expectException(LogicException::class);
$this->expectExceptionMessage('The getDependencies() method returned a class (Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\RequiredConstructorArgsFixtures) that has required constructor arguments. Upgrade to "doctrine/data-fixtures" version 1.3 or higher to support this.');

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);

$this->expectException(LogicException::class);
$this->expectExceptionMessage('The getDependencies() method returned a class (Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\RequiredConstructorArgsFixtures) that has required constructor arguments. Upgrade to "doctrine/data-fixtures" version 1.3 or higher to support this.');

$loader->getFixtures();
}

Expand All @@ -150,10 +151,7 @@ public function testExceptionIfDependentFixtureNotWired(): void
$this->expectException(LogicException::class);
$this->expectExceptionMessage('The "Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\RequiredConstructorArgsFixtures" fixture class is trying to be loaded, but is not available. Make sure this class is defined as a service and tagged with "doctrine.fixture.orm".');

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);

$loader->getFixtures();
$container->get('test.doctrine.fixtures.loader');
}

public function testFixturesLoaderWithGroupsOptionViaInterface(): void
Expand All @@ -174,7 +172,7 @@ public function testFixturesLoaderWithGroupsOptionViaInterface(): void
$container = $kernel->getContainer();

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);
$this->assertInstanceOf(SymfonyFixturesLoader::class, $loader);

$actualFixtures = $loader->getFixtures(['staging']);
$this->assertCount(1, $actualFixtures);
Expand All @@ -194,6 +192,7 @@ public function testFixturesLoaderWithGroupsOptionViaTag(): void
$kernel->addServices(static function (ContainerBuilder $c): void {
// has a "staging" group via the getGroups() method
$c->autowire(OtherFixtures::class)
->setAutoconfigured(true)
->addTag(FixturesCompilerPass::FIXTURE_TAG, ['group' => 'group1'])
->addTag(FixturesCompilerPass::FIXTURE_TAG, ['group' => 'group2']);

Expand All @@ -207,7 +206,7 @@ public function testFixturesLoaderWithGroupsOptionViaTag(): void
$container = $kernel->getContainer();

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);
$this->assertInstanceOf(SymfonyFixturesLoader::class, $loader);

$this->assertCount(1, $loader->getFixtures(['staging']));
$this->assertCount(1, $loader->getFixtures(['group1']));
Expand All @@ -233,7 +232,7 @@ public function testLoadFixturesViaGroupWithMissingDependency(): void
$container = $kernel->getContainer();

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);
$this->assertInstanceOf(SymfonyFixturesLoader::class, $loader);

$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Fixture "Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\OtherFixtures" was declared as a dependency for fixture "Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\WithDependenciesFixtures", but it was not included in any of the loaded fixture groups.');
Expand All @@ -259,7 +258,7 @@ public function testLoadFixturesViaGroupWithFulfilledDependency(): void
$container = $kernel->getContainer();

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);
$this->assertInstanceOf(SymfonyFixturesLoader::class, $loader);

$actualFixtures = $loader->getFixtures(['fulfilledDependencyGroup']);

Expand Down Expand Up @@ -292,7 +291,7 @@ public function testLoadFixturesByShortName(): void
$container = $kernel->getContainer();

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);
$this->assertInstanceOf(SymfonyFixturesLoader::class, $loader);

$actualFixtures = $loader->getFixtures(['OtherFixtures']);

Expand Down Expand Up @@ -329,7 +328,7 @@ public function testRunCommandWithDefaultPurger(): void
$kernel->boot();
$container = $kernel->getContainer();

$em = $this->createConfiguredMock(EntityManagerInterface::class, ['getConnection' => $this->createMock(Connection::class), 'getEventManager' => $this->createMock(EventManager::class)]);
$em = $this->createConfiguredMock(ForwardCompatibleEntityManager::class, ['getConnection' => $this->createMock(Connection::class), 'getEventManager' => $this->createMock(EventManager::class)]);
$registry = $this->createMock(ManagerRegistry::class);
$registry
->expects(self::once())
Expand Down Expand Up @@ -376,7 +375,7 @@ public function testRunCommandWithPurgeExclusions(): void
$kernel->boot();
$container = $kernel->getContainer();

$em = $this->createConfiguredMock(EntityManagerInterface::class, ['getConnection' => $this->createMock(Connection::class), 'getEventManager' => $this->createMock(EventManager::class)]);
$em = $this->createConfiguredMock(ForwardCompatibleEntityManager::class, ['getConnection' => $this->createMock(Connection::class), 'getEventManager' => $this->createMock(EventManager::class)]);
$registry = $this->createMock(ManagerRegistry::class);
$registry
->expects(self::once())
Expand Down Expand Up @@ -426,7 +425,7 @@ public function testRunCommandWithCustomPurgerAndCustomEntityManager(): void
$kernel->boot();
$container = $kernel->getContainer();

$em = $this->createConfiguredMock(EntityManagerInterface::class, ['getConnection' => $this->createMock(Connection::class), 'getEventManager' => $this->createMock(EventManager::class)]);
$em = $this->createConfiguredMock(ForwardCompatibleEntityManager::class, ['getConnection' => $this->createMock(Connection::class), 'getEventManager' => $this->createMock(EventManager::class)]);
$registry = $this->createMock(ManagerRegistry::class);
$registry
->expects(self::once())
Expand Down Expand Up @@ -473,7 +472,7 @@ public function testRunCommandWithPurgeMode(): void
$kernel->boot();
$container = $kernel->getContainer();

$em = $this->createConfiguredMock(EntityManagerInterface::class, ['getConnection' => $this->createMock(Connection::class), 'getEventManager' => $this->createMock(EventManager::class)]);
$em = $this->createConfiguredMock(ForwardCompatibleEntityManager::class, ['getConnection' => $this->createMock(Connection::class), 'getEventManager' => $this->createMock(EventManager::class)]);
$registry = $this->createMock(ManagerRegistry::class);
$registry
->expects(self::once())
Expand All @@ -497,3 +496,11 @@ public function testRunCommandWithPurgeMode(): void
$tester->execute(['--purge-with-truncate' => true], ['interactive' => false]);
}
}

interface ForwardCompatibleEntityManager extends EntityManagerInterface
{
/**
* @return mixed
*/
public function wrapInTransaction(callable $func);
}
11 changes: 11 additions & 0 deletions Tests/IntegrationTestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\FooBundle;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;

Expand Down Expand Up @@ -77,4 +78,14 @@ public function getLogDir(): string
{
return sys_get_temp_dir();
}

protected function build(ContainerBuilder $container)
{
$container->addCompilerPass(new class implements CompilerPassInterface {
public function process(ContainerBuilder $container): void
{
$container->findDefinition('doctrine')->setPublic(true);
}
});
}
}
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@
"symfony/http-kernel": "^3.4|^4.3|^5.0|^6.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.0",
"phpstan/phpstan": "^0.12.99",
"phpunit/phpunit": "^7.4 || ^8.0 || ^9.2",
"symfony/phpunit-bridge": "^4.1|^5.0|^6.0",
"vimeo/psalm": "^4.10"
"doctrine/coding-standard": "^9",
"phpstan/phpstan": "^1.4.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20",
"symfony/phpunit-bridge": "^6.0.8",
"vimeo/psalm": "^4.22"
},
"autoload": {
"psr-4": { "Doctrine\\Bundle\\FixturesBundle\\": "" }
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ parameters:
count: 1
path: Tests/Fixtures/FooBundle/DataFixtures/RequiredConstructorArgsFixtures.php

-
message: "#^Method Doctrine\\\\Common\\\\DataFixtures\\\\Loader\\:\\:getFixtures\\(\\) invoked with 1 parameter, 0 required\\.$#"
count: 8
path: Tests/IntegrationTest.php

4 changes: 2 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
parameters:
phpVersion: 70100
phpVersion: 80100
level: 3
paths:
- .
excludes_analyse:
excludePaths:
- vendor

includes:
Expand Down
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.10.0@916b098b008f6de4543892b1e0651c1c3b92cbfa">
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<file src="Command/LoadDataFixturesDoctrineCommand.php">
<UndefinedClass occurrences="1">
<code>PoolingShardConnection</code>
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
phpVersion="8.1"
>
<projectFiles>
<directory name="Command" />
Expand Down

0 comments on commit e852250

Please sign in to comment.