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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
done

- name: Run tests
run: vendor/bin/phpunit --verbose --stop-on-failure
run: vendor/bin/phpunit --stop-on-failure

# This is a "trick", a meta task which does not change, and we can use in
# the protected branch rules as opposed to the individual tests which
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"theofidry/alice-data-fixtures": "^1.10"
},
"require-dev": {
"phpunit/phpunit": "^9.6.17",
"phpunit/phpunit": "^11.0",
"phpspec/prophecy": "^1.14.0",
"phpspec/prophecy-phpunit": "^2.0",
"monolog/monolog": "^3.5",
Expand Down
Binary file added php-cs-fixer.phar
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theofidry was there any reason to commit the php-cs-fixer phar ?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, surprised I didn't already add it to the gitignore either

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest adding php-cs-fixer/shim as a dev dependency instead to let composer install the phar (and control which version is used)

Binary file not shown.
9 changes: 3 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
forceCoversAnnotation="true"
verbose="true">
colors="true">

<php>
<server name="APP_ENV" value="test" force="true" />
<server name="KERNEL_DIR" value="tests/Functional" />
<server name="KERNEL_CLASS" value="Hautelook\AliceBundle\Functional\TestKernel" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
</php>

<testsuites>
Expand All @@ -18,10 +15,10 @@
</testsuite>
</testsuites>

<coverage>
<source>
<include>
<directory>src</directory>
</include>
</coverage>
</source>

</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@
use Nelmio\Alice\ObjectBag;
use Nelmio\Alice\ParameterBag;
use Nelmio\Alice\Throwable\Exception\Generator\Instantiator\InstantiationException;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use Symfony\Component\DependencyInjection\Container;

/**
* @covers \Hautelook\AliceBundle\Alice\Generator\Instantiator\Chainable\InstantiatedReferenceInstantiator
*/
#[CoversClass(InstantiatedReferenceInstantiator::class)]
class InstantiatedReferenceInstantiatorTest extends TestCase
{
public function testIsAChainableInstantiator(): void
Expand Down
5 changes: 2 additions & 3 deletions tests/Alice/Loader/ServiceFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@

use Hautelook\AliceBundle\Functional\TestBundle\Entity\CityFactory;
use Hautelook\AliceBundle\Functional\TestKernel;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\TestCase;

/**
* @coversNothing
*/
#[CoversNothing]
class ServiceFactoryTest extends TestCase
{
public function testCanUseServiceFactory(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
use Hautelook\AliceBundle\Functional\TestBundle\Entity\Brand;
use Hautelook\AliceBundle\Functional\TestBundle\Entity\Product;
use Hautelook\AliceBundle\Functional\TestKernel;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use function preg_replace;
use function str_replace;
Expand All @@ -31,11 +34,8 @@
use Symfony\Component\HttpKernel\KernelInterface;
use function trim;

/**
* @coversNothing
*
* @group legacy
*/
#[Group('legacy')]
#[CoversNothing]
class LoadDataFixturesCommandIntegrationTest extends TestCase
{
private Application $application;
Expand Down Expand Up @@ -119,9 +119,7 @@ public function testAppendFixtures(): void
$this->verifyBrands(20);
}

/**
* @dataProvider loadCommandProvider
*/
#[DataProvider('loadCommandProvider')]
public function testFixturesRegisteringUsingInvalidManager(array $inputs, string $expected): void
{
$this->expectException(\InvalidArgumentException::class);
Expand All @@ -143,9 +141,7 @@ public function testFixturesRegisteringUsingInvalidManager(array $inputs, string
self::assertFixturesDisplayEquals($expected, $commandTester->getDisplay());
}

/**
* @dataProvider loadCommandProvider
*/
#[DataProvider('loadCommandProvider')]
public function testFixturesRegisteringUsingMySQL(array $inputs, string $expected)
{
$command = $this->application->find('hautelook:fixtures:load');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
use Hautelook\AliceBundle\LoaderInterface;
use Hautelook\AliceBundle\Persistence\FakeDoctrineManagerRegistry;
use Hautelook\AliceBundle\Persistence\ObjectMapper\FakeEntityManager;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
Expand All @@ -30,11 +32,8 @@
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;

/**
* @covers \Hautelook\AliceBundle\Console\Command\Doctrine\DoctrineOrmLoadDataFixturesCommand
*
* @group legacy
*/
#[Group('legacy')]
#[CoversClass(DoctrineOrmLoadDataFixturesCommand::class)]
class LoadDataFixturesCommandTest extends TestCase
{
use ProphecyTrait;
Expand Down
5 changes: 2 additions & 3 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@

namespace Hautelook\AliceBundle\DependencyInjection;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\Processor;

/**
* @covers \Hautelook\AliceBundle\DependencyInjection\Configuration
*/
#[CoversClass(Configuration::class)]
class ConfigurationTest extends TestCase
{
public function testDefaultValues(): void
Expand Down
10 changes: 5 additions & 5 deletions tests/DependencyInjection/HautelookAliceBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Hautelook\AliceBundle\Functional\AppKernel;
use Hautelook\AliceBundle\Functional\ConfigurableKernel;
use Hautelook\AliceBundle\Functional\WithoutDoctrineKernel;
use Hautelook\AliceBundle\HautelookAliceBundle;
use Hautelook\AliceBundle\Loader\DoctrineOrmLoader;
use Hautelook\AliceBundle\LoaderInterface as HautelookLoaderInterface;
use Hautelook\AliceBundle\Locator\EnvDirectoryLocator;
Expand All @@ -30,13 +31,12 @@
use Hautelook\AliceBundle\Resolver\Bundle\SimpleBundleResolver;
use LogicException;
use Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

/**
* @covers \Hautelook\AliceBundle\HautelookAliceBundle
* @covers \Hautelook\AliceBundle\DependencyInjection\Configuration
* @covers \Hautelook\AliceBundle\DependencyInjection\HautelookAliceExtension
*/
#[CoversClass(HautelookAliceBundle::class)]
#[CoversClass(Configuration::class)]
#[CoversClass(HautelookAliceExtension::class)]
class HautelookAliceBundleTest extends KernelTestCase
{
public function testCannotBootIfFidryAliceDataFixturesBundleIsNotRegistered(): void
Expand Down
5 changes: 2 additions & 3 deletions tests/Loader/DoctrineOrmLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
use Hautelook\AliceBundle\Resolver\FakeBundleResolver;
use InvalidArgumentException;
use function is_a;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use ReflectionClass;

/**
* @covers \Hautelook\AliceBundle\Loader\DoctrineOrmLoader
*/
#[CoversClass(DoctrineOrmLoader::class)]
class DoctrineOrmLoaderTest extends TestCase
{
public function testIsALoader(): void
Expand Down
18 changes: 7 additions & 11 deletions tests/Locator/EnvDirectoryLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
use Hautelook\AliceBundle\Locator\EnvDirectoryLocator\DummyBundle\DummyBundle;
use Hautelook\AliceBundle\Locator\EnvDirectoryLocator\EmptyBundle\EmptyBundle;
use Hautelook\AliceBundle\Locator\EnvDirectoryLocator\OneMoreDummyBundle\OneMoreDummyBundle;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use function realpath;
use ReflectionClass;

/**
* @covers \Hautelook\AliceBundle\Locator\EnvDirectoryLocator
*/
#[CoversClass(EnvDirectoryLocator::class)]
class EnvDirectoryLocatorTest extends TestCase
{
public function testIsAFixtureLocator(): void
Expand All @@ -38,9 +38,7 @@ public function testIsNotClonable(): void
self::assertFalse((new ReflectionClass(EnvDirectoryLocator::class))->isCloneable());
}

/**
* @dataProvider provideSets
*/
#[DataProvider('provideSets')]
public function testGetFilesFromABundle(array $bundles, string $environment, array $paths, array $expected): void
{
$invalidPath = '';
Expand All @@ -50,7 +48,7 @@ public function testGetFilesFromABundle(array $bundles, string $environment, arr
self::assertEqualsCanonicalizing($expected, $actual);
}

public function provideSets(): ?\Generator
public static function provideSets(): iterable
{
yield 'bundle without any resources' => [
[new EmptyBundle()],
Expand Down Expand Up @@ -145,9 +143,7 @@ public function provideSets(): ?\Generator
];
}

/**
* @dataProvider provideSetsForSeveralBundles
*/
#[DataProvider('provideSetsForSeveralBundles')]
public function testGetFilesFromSeveralBundles(
array $bundles,
string $environment,
Expand All @@ -161,7 +157,7 @@ public function testGetFilesFromSeveralBundles(
self::assertEqualsCanonicalizing($expected, $actual);
}

public function provideSetsForSeveralBundles(): ?\Generator
public static function provideSetsForSeveralBundles(): iterable
{
$baseDir = 'Resources'.DIRECTORY_SEPARATOR.'fixtures';
$baseDir2 = 'Resources'.DIRECTORY_SEPARATOR.'fixtures2';
Expand Down
5 changes: 2 additions & 3 deletions tests/Locator/EnvironmentlessFilesLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@

use Hautelook\AliceBundle\FixtureLocatorInterface;
use function is_a;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use ReflectionClass;

/**
* @covers \Hautelook\AliceBundle\Locator\EnvironmentlessFilesLocator
*/
#[CoversClass(EnvironmentlessFilesLocator::class)]
class EnvironmentlessFilesLocatorTest extends TestCase
{
use ProphecyTrait;
Expand Down
4 changes: 2 additions & 2 deletions tests/PhpUnit/RecreateDatabaseTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

namespace Hautelook\AliceBundle\PhpUnit;

use PHPUnit\Framework\Attributes\CoversNothing;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

/**
* @author Gary PEGEOT <garypegeot@gmail.com>
*
* @coversNothing
*/
#[CoversNothing]
class RecreateDatabaseTraitTest extends KernelTestCase
{
use RecreateDatabaseTrait;
Expand Down
4 changes: 2 additions & 2 deletions tests/PhpUnit/RefreshDatabaseTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

namespace Hautelook\AliceBundle\PhpUnit;

use PHPUnit\Framework\Attributes\CoversNothing;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

/**
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @coversNothing
*/
#[CoversNothing]
class RefreshDatabaseTraitTest extends KernelTestCase
{
use RefreshDatabaseTrait;
Expand Down
4 changes: 2 additions & 2 deletions tests/PhpUnit/ReloadDatabaseTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

namespace Hautelook\AliceBundle\PhpUnit;

use PHPUnit\Framework\Attributes\CoversNothing;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

/**
* @author Kévin Dunglas <dunglas@gmail.com>
*
* @coversNothing
*/
#[CoversNothing]
class ReloadDatabaseTraitTest extends KernelTestCase
{
use RefreshTestTrait;
Expand Down
5 changes: 2 additions & 3 deletions tests/Resolver/Bundle/NoBundleResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
use Hautelook\AliceBundle\Resolver\FakeBundleResolver;
use Hautelook\AliceBundle\Resolver\ResolverKernel;
use function is_a;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use ReflectionClass;
use Symfony\Bundle\FrameworkBundle\Console\Application;

/**
* @covers \Hautelook\AliceBundle\Resolver\Bundle\NoBundleResolver
*/
#[CoversClass(NoBundleResolver::class)]
class NoBundleResolverTest extends TestCase
{
use ProphecyTrait;
Expand Down
5 changes: 2 additions & 3 deletions tests/Resolver/Bundle/SimpleBundleResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
use Hautelook\AliceBundle\BundleResolverInterface;
use Hautelook\AliceBundle\Resolver\ResolverKernel;
use function is_a;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use Symfony\Bundle\FrameworkBundle\Console\Application;

/**
* @covers \Hautelook\AliceBundle\Resolver\Bundle\SimpleBundleResolver
*/
#[CoversClass(SimpleBundleResolver::class)]
class SimpleBundleResolverTest extends TestCase
{
public function testIsABundleResolver(): void
Expand Down
5 changes: 2 additions & 3 deletions tests/Resolver/File/KernelFileResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@
use Hautelook\AliceBundle\HttpKernel\DummyKernel;
use InvalidArgumentException;
use function is_a;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use function realpath;
use ReflectionClass;
use Symfony\Component\HttpKernel\KernelInterface;
use TypeError;

/**
* @covers \Hautelook\AliceBundle\Resolver\File\KernelFileResolver
*/
#[CoversClass(KernelFileResolver::class)]
class KernelFileResolverTest extends TestCase
{
use ProphecyTrait;
Expand Down
Loading