Commits (2)
...@@ -7,3 +7,7 @@ PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots ...@@ -7,3 +7,7 @@ PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
# API Platform distribution # API Platform distribution
TRUSTED_HOSTS=^example\.com|localhost$ TRUSTED_HOSTS=^example\.com|localhost$
APP_ENV=test
DATABASE_URL="postgresql://app:!ChangeMe!@database:5432/app_test?serverVersion=16&charset=utf8"
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
}, },
"require-dev": { "require-dev": {
"api-platform/schema-generator": "^5.0", "api-platform/schema-generator": "^5.0",
"dama/doctrine-test-bundle": "^8.3",
"doctrine/doctrine-fixtures-bundle": "^4.3", "doctrine/doctrine-fixtures-bundle": "^4.3",
"phpoffice/phpspreadsheet": "^5.4", "phpoffice/phpspreadsheet": "^5.4",
"symfony/browser-kit": "7.2.*", "symfony/browser-kit": "7.2.*",
...@@ -41,7 +42,8 @@ ...@@ -41,7 +42,8 @@
"symfony/phpunit-bridge": "7.2.*", "symfony/phpunit-bridge": "7.2.*",
"symfony/stopwatch": "7.2.*", "symfony/stopwatch": "7.2.*",
"symfony/var-dumper": "7.2.*", "symfony/var-dumper": "7.2.*",
"symfony/web-profiler-bundle": "7.2.*" "symfony/web-profiler-bundle": "7.2.*",
"zenstruck/foundry": "^2.9"
}, },
"config": { "config": {
"optimize-autoloader": true, "optimize-autoloader": true,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "4aa52f0fd0cd346f50dc5d5b9c9e483f", "content-hash": "2379e6b4d928d5171109f603a303b3f5",
"packages": [ "packages": [
{ {
"name": "api-platform/doctrine-common", "name": "api-platform/doctrine-common",
...@@ -7697,6 +7697,75 @@ ...@@ -7697,6 +7697,75 @@
], ],
"time": "2024-05-06T16:37:16+00:00" "time": "2024-05-06T16:37:16+00:00"
}, },
{
"name": "dama/doctrine-test-bundle",
"version": "v8.3.1",
"source": {
"type": "git",
"url": "https://github.com/dmaicher/doctrine-test-bundle.git",
"reference": "9bc47e02a0d67cbfef6773837249f71e65c95bf6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dmaicher/doctrine-test-bundle/zipball/9bc47e02a0d67cbfef6773837249f71e65c95bf6",
"reference": "9bc47e02a0d67cbfef6773837249f71e65c95bf6",
"shasum": ""
},
"require": {
"doctrine/dbal": "^3.3 || ^4.0",
"doctrine/doctrine-bundle": "^2.11.0",
"php": ">= 8.1",
"psr/cache": "^2.0 || ^3.0",
"symfony/cache": "^6.4 || ^7.2 || ^8.0",
"symfony/framework-bundle": "^6.4 || ^7.2 || ^8.0"
},
"conflict": {
"phpunit/phpunit": "<10.0"
},
"require-dev": {
"behat/behat": "^3.0",
"friendsofphp/php-cs-fixer": "^3.27",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^10.0 || ^11.0 || ^12.0",
"symfony/process": "^6.4 || ^7.2 || ^8.0",
"symfony/yaml": "^6.4 || ^7.2 || ^8.0"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "8.x-dev"
}
},
"autoload": {
"psr-4": {
"DAMA\\DoctrineTestBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "David Maicher",
"email": "mail@dmaicher.de"
}
],
"description": "Symfony bundle to isolate doctrine database tests and improve test performance",
"keywords": [
"doctrine",
"isolation",
"performance",
"symfony",
"testing",
"tests"
],
"support": {
"issues": "https://github.com/dmaicher/doctrine-test-bundle/issues",
"source": "https://github.com/dmaicher/doctrine-test-bundle/tree/v8.3.1"
},
"time": "2025-08-05T17:55:02+00:00"
},
{ {
"name": "devizzent/cebe-php-openapi", "name": "devizzent/cebe-php-openapi",
"version": "1.1.4", "version": "1.1.4",
...@@ -7989,6 +8058,69 @@ ...@@ -7989,6 +8058,69 @@
}, },
"time": "2023-08-08T05:53:35+00:00" "time": "2023-08-08T05:53:35+00:00"
}, },
{
"name": "fakerphp/faker",
"version": "v1.24.1",
"source": {
"type": "git",
"url": "https://github.com/FakerPHP/Faker.git",
"reference": "e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FakerPHP/Faker/zipball/e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5",
"reference": "e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
"psr/container": "^1.0 || ^2.0",
"symfony/deprecation-contracts": "^2.2 || ^3.0"
},
"conflict": {
"fzaninotto/faker": "*"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"doctrine/persistence": "^1.3 || ^2.0",
"ext-intl": "*",
"phpunit/phpunit": "^9.5.26",
"symfony/phpunit-bridge": "^5.4.16"
},
"suggest": {
"doctrine/orm": "Required to use Faker\\ORM\\Doctrine",
"ext-curl": "Required by Faker\\Provider\\Image to download images.",
"ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.",
"ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.",
"ext-mbstring": "Required for multibyte Unicode string functionality."
},
"type": "library",
"autoload": {
"psr-4": {
"Faker\\": "src/Faker/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "François Zaninotto"
}
],
"description": "Faker is a PHP library that generates fake data for you.",
"keywords": [
"data",
"faker",
"fixtures"
],
"support": {
"issues": "https://github.com/FakerPHP/Faker/issues",
"source": "https://github.com/FakerPHP/Faker/tree/v1.24.1"
},
"time": "2024-11-21T13:46:39+00:00"
},
{ {
"name": "fidry/cpu-core-counter", "name": "fidry/cpu-core-counter",
"version": "1.2.0", "version": "1.2.0",
...@@ -10391,16 +10523,16 @@ ...@@ -10391,16 +10523,16 @@
}, },
{ {
"name": "symfony/phpunit-bridge", "name": "symfony/phpunit-bridge",
"version": "v7.2.0", "version": "v7.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/phpunit-bridge.git", "url": "https://github.com/symfony/phpunit-bridge.git",
"reference": "2bbde92ab25a0e2c88160857af7be9db5da0d145" "reference": "860206b88792463da3bb64763c224c29ddbe9729"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/2bbde92ab25a0e2c88160857af7be9db5da0d145", "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/860206b88792463da3bb64763c224c29ddbe9729",
"reference": "2bbde92ab25a0e2c88160857af7be9db5da0d145", "reference": "860206b88792463da3bb64763c224c29ddbe9729",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -10452,8 +10584,11 @@ ...@@ -10452,8 +10584,11 @@
], ],
"description": "Provides utilities for PHPUnit, especially user deprecation notices management", "description": "Provides utilities for PHPUnit, especially user deprecation notices management",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"keywords": [
"testing"
],
"support": { "support": {
"source": "https://github.com/symfony/phpunit-bridge/tree/v7.2.0" "source": "https://github.com/symfony/phpunit-bridge/tree/v7.2.8"
}, },
"funding": [ "funding": [
{ {
...@@ -10469,7 +10604,87 @@ ...@@ -10469,7 +10604,87 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-11-13T16:15:23+00:00" "time": "2025-06-04T10:08:59+00:00"
},
{
"name": "symfony/polyfill-php85",
"version": "v1.33.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php85.git",
"reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91",
"reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php85\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php85/tree/v1.33.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2025-06-23T16:12:55+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
...@@ -10614,6 +10829,193 @@ ...@@ -10614,6 +10829,193 @@
], ],
"time": "2025-02-14T14:27:24+00:00" "time": "2025-02-14T14:27:24+00:00"
}, },
{
"name": "zenstruck/assert",
"version": "v1.7.0",
"source": {
"type": "git",
"url": "https://github.com/zenstruck/assert.git",
"reference": "1e32d48847d4e82c345112ca226b21a1a792af0a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zenstruck/assert/zipball/1e32d48847d4e82c345112ca226b21a1a792af0a",
"reference": "1e32d48847d4e82c345112ca226b21a1a792af0a",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/polyfill-php81": "^1.23",
"symfony/var-exporter": "^5.4|^6.0|^7.0|^8.0"
},
"require-dev": {
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5.21",
"symfony/phpunit-bridge": "^6.3|^7.0|^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Zenstruck\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Bond",
"email": "kevinbond@gmail.com"
}
],
"description": "Standalone, lightweight, framework agnostic, test assertion library.",
"homepage": "https://github.com/zenstruck/assert",
"keywords": [
"assertion",
"phpunit",
"test"
],
"support": {
"issues": "https://github.com/zenstruck/assert/issues",
"source": "https://github.com/zenstruck/assert/tree/v1.7.0"
},
"funding": [
{
"url": "https://github.com/kbond",
"type": "github"
},
{
"url": "https://github.com/nikophil",
"type": "github"
}
],
"time": "2025-12-07T01:59:12+00:00"
},
{
"name": "zenstruck/foundry",
"version": "v2.9.1",
"source": {
"type": "git",
"url": "https://github.com/zenstruck/foundry.git",
"reference": "304e5333e62745a8f1b70e40b284c1d278b61cf0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zenstruck/foundry/zipball/304e5333e62745a8f1b70e40b284c1d278b61cf0",
"reference": "304e5333e62745a8f1b70e40b284c1d278b61cf0",
"shasum": ""
},
"require": {
"fakerphp/faker": "^1.24",
"php": ">=8.1",
"symfony/deprecation-contracts": "^2.2|^3.0",
"symfony/polyfill-php84": "^1.32",
"symfony/polyfill-php85": "^1.33",
"symfony/property-access": "^6.4|^7.0|^8.0",
"symfony/property-info": "^6.4|^7.0|^8.0",
"symfony/var-exporter": "^6.4.9|~7.0.9|^7.1.2|^8.0",
"zenstruck/assert": "^1.4"
},
"conflict": {
"doctrine/cache": "<1.12.1",
"doctrine/persistence": "<2.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"dama/doctrine-test-bundle": "^8.0",
"doctrine/collections": "^1.7|^2.0",
"doctrine/common": "^3.2.2",
"doctrine/doctrine-bundle": "^2.10|^3.0",
"doctrine/doctrine-migrations-bundle": "^2.2|^3.0",
"doctrine/mongodb-odm": "^2.4",
"doctrine/mongodb-odm-bundle": "^4.6|^5.0",
"doctrine/orm": "^2.16|^3.0",
"doctrine/persistence": "^2.0|^3.0|^4.0",
"phpunit/phpunit": "^9.5.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0",
"symfony/browser-kit": "^6.4|^7.0|^8.0",
"symfony/console": "^6.4|^7.0|^8.0",
"symfony/dotenv": "^6.4|^7.0|^8.0",
"symfony/event-dispatcher": "^6.4|^7.0|^8.0",
"symfony/flex": "^2.10",
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
"symfony/maker-bundle": "^1.55",
"symfony/phpunit-bridge": "^6.4.26|^7.0|^8.0",
"symfony/routing": "^6.4|^7.0|^8.0",
"symfony/runtime": "^6.4|^7.0|^8.0",
"symfony/translation-contracts": "^3.4",
"symfony/uid": "^6.4|^7.0|^8.0",
"symfony/var-dumper": "^6.4|^7.0|^8.0",
"symfony/yaml": "^6.4|^7.0|^8.0",
"webmozart/assert": "^1.11"
},
"type": "library",
"extra": {
"psalm": {
"pluginClass": "Zenstruck\\Foundry\\Psalm\\FoundryPlugin"
},
"symfony": {
"allow-contrib": false
},
"bamarni-bin": {
"bin-links": true,
"forward-command": false,
"target-directory": "bin/tools"
}
},
"autoload": {
"files": [
"src/functions.php",
"src/Persistence/functions.php",
"src/symfony_console.php"
],
"psr-4": {
"Zenstruck\\Foundry\\": "src/",
"Zenstruck\\Foundry\\Psalm\\": "utils/psalm",
"Zenstruck\\Foundry\\Utils\\Rector\\": "utils/rector/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kevin Bond",
"email": "kevinbond@gmail.com"
},
{
"name": "Nicolas PHILIPPE",
"email": "nikophil@gmail.com"
}
],
"description": "A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.",
"homepage": "https://github.com/zenstruck/foundry",
"keywords": [
"Fixture",
"dev",
"doctrine",
"factory",
"faker",
"symfony",
"test"
],
"support": {
"issues": "https://github.com/zenstruck/foundry/issues",
"source": "https://github.com/zenstruck/foundry/tree/v2.9.1"
},
"funding": [
{
"url": "https://github.com/kbond",
"type": "github"
},
{
"url": "https://github.com/nikophil",
"type": "github"
}
],
"time": "2026-02-08T14:53:41+00:00"
},
{ {
"name": "zozlak/rdf-constants", "name": "zozlak/rdf-constants",
"version": "1.2.1", "version": "1.2.1",
......
...@@ -14,4 +14,5 @@ return [ ...@@ -14,4 +14,5 @@ return [
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'test' => true],
]; ];
when@dev: &dev
# See full configuration: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#full-default-bundle-configuration
zenstruck_foundry:
when@test: *dev
<?php
namespace App\Factory;
use App\Entity\Commune;
use Zenstruck\Foundry\Persistence\PersistentObjectFactory;
/**
* @extends PersistentObjectFactory<Commune>
*/
final class CommuneFactory extends PersistentObjectFactory
{
#[\Override]
public static function class(): string
{
return Commune::class;
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
*
*/
#[\Override]
protected function defaults(): array|callable
{
return [
'code' => self::faker()->randomNumber(),
'departement' => DepartementFactory::new(),
'nom' => self::faker()->text(255),
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
#[\Override]
protected function initialize(): static
{
return $this
// ->afterInstantiate(function(Commune $commune): void {})
;
}
}
<?php
namespace App\Factory;
use App\Entity\Departement;
use Zenstruck\Foundry\Persistence\PersistentObjectFactory;
/**
* @extends PersistentObjectFactory<Departement>
*/
final class DepartementFactory extends PersistentObjectFactory
{
#[\Override]
public static function class(): string
{
return Departement::class;
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
*
*/
#[\Override]
protected function defaults(): array|callable
{
return [
'code' => self::faker()->randomNumber(),
'nom' => self::faker()->text(255),
'region' => RegionFactory::new(),
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
#[\Override]
protected function initialize(): static
{
return $this
// ->afterInstantiate(function(Departement $departement): void {})
;
}
}
<?php
namespace App\Factory;
use App\Entity\Region;
use Zenstruck\Foundry\Persistence\PersistentObjectFactory;
/**
* @extends PersistentObjectFactory<Region>
*/
final class RegionFactory extends PersistentObjectFactory
{
#[\Override]
public static function class(): string
{
return Region::class;
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
*
*/
#[\Override]
protected function defaults(): array|callable
{
return [
'nom' => self::faker()->text(255),
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
#[\Override]
protected function initialize(): static
{
return $this
// ->afterInstantiate(function(Region $region): void {})
;
}
}
<?php
namespace App\Factory;
use App\Entity\Taxe;
use Zenstruck\Foundry\Persistence\PersistentObjectFactory;
/**
* @extends PersistentObjectFactory<Taxe>
*/
final class TaxeFactory extends PersistentObjectFactory
{
#[\Override]
public static function class(): string
{
return Taxe::class;
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
*
*/
#[\Override]
protected function defaults(): array|callable
{
return [
'annee' => self::faker()->randomNumber(),
'commune' => CommuneFactory::new(),
'taux' => self::faker()->randomFloat(),
'type' => TypeTaxeFactory::new(),
'volume' => self::faker()->randomFloat(),
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
#[\Override]
protected function initialize(): static
{
return $this
// ->afterInstantiate(function(Taxe $taxe): void {})
;
}
}
<?php
namespace App\Factory;
use App\Entity\TypeTaxe;
use Zenstruck\Foundry\Persistence\PersistentObjectFactory;
/**
* @extends PersistentObjectFactory<TypeTaxe>
*/
final class TypeTaxeFactory extends PersistentObjectFactory
{
#[\Override]
public static function class(): string
{
return TypeTaxe::class;
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
*
*/
#[\Override]
protected function defaults(): array|callable
{
return [
'code' => self::faker()->text(5),
'label' => self::faker()->text(255),
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
#[\Override]
protected function initialize(): static
{
return $this
// ->afterInstantiate(function(TypeTaxe $typeTaxe): void {})
;
}
}
...@@ -13,6 +13,15 @@ ...@@ -13,6 +13,15 @@
"src/ApiResource/.gitignore" "src/ApiResource/.gitignore"
] ]
}, },
"dama/doctrine-test-bundle": {
"version": "8.3",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "main",
"version": "8.3",
"ref": "dfc51177476fb39d014ed89944cde53dc3326d23"
}
},
"doctrine/deprecations": { "doctrine/deprecations": {
"version": "1.1", "version": "1.1",
"recipe": { "recipe": {
...@@ -261,5 +270,17 @@ ...@@ -261,5 +270,17 @@
"config/packages/web_profiler.yaml", "config/packages/web_profiler.yaml",
"config/routes/web_profiler.yaml" "config/routes/web_profiler.yaml"
] ]
},
"zenstruck/foundry": {
"version": "2.9",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.0",
"ref": "56bc588a1b6d5d218319f70c64c2f0fbebe30ec7"
},
"files": [
"config/packages/zenstruck_foundry.yaml"
]
} }
} }
<?php
namespace App\tests\Api;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Factory\CommuneFactory;
class CommuneTest extends ApiTestCase
{
public function testGetCommunesCollection(): void
{
$response = static::createClient()->request('GET', '/communes');
$this->assertResponseIsSuccessful();
// Vérifie que c'est du JSON-LD (standard API Platform)
$this->assertJsonContains([
'@type' => 'Collection',
]);
}
public function testGetCommune(): void
{
$commune = CommuneFactory::createOne();
$response = static::createClient()->request('GET', '/communes/' . $commune->getId());
$this->assertResponseIsSuccessful();
$this->assertJsonContains([
'@id' => '/communes/' . $commune->getId(),
]);
}
}
<?php
namespace App\tests\Api;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Factory\DepartementFactory;
class DepartementTest extends ApiTestCase
{
public function testGetDepartementCollection(): void
{
// Remplace '/api/taxes' par l'URL réelle de ta ressource API
$response = static::createClient()->request('GET', '/departements');
$this->assertResponseIsSuccessful();
// Vérifie que c'est du JSON-LD (standard API Platform)
$this->assertJsonContains([
'@type' => 'Collection',
]);
}
public function testGetDepartement(): void
{
$departement = DepartementFactory::createOne();
$response = static::createClient()->request('GET', '/departements/' . $departement->getId());
$this->assertResponseIsSuccessful();
$this->assertJsonContains([
'id' => $departement->getId(),
]);
}
}
<?php
namespace App\Tests\Api;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
class GreetingsTest extends ApiTestCase
{
public function testCreateGreeting(): void
{
static::createClient()->request('POST', '/greetings', [
'json' => [
'name' => 'Kévin',
],
'headers' => [
'Content-Type' => 'application/ld+json',
],
]);
$this->assertResponseStatusCodeSame(201);
$this->assertJsonContains([
'@context' => '/contexts/Greeting',
'@type' => 'Greeting',
'name' => 'Kévin',
]);
}
}
<?php
namespace App\tests\Api;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Factory\RegionFactory;
class RegionTest extends ApiTestCase
{
public function testGetRegionCollection(): void
{
// Remplace '/api/taxes' par l'URL réelle de ta ressource API
$response = static::createClient()->request('GET', '/regions');
$this->assertResponseIsSuccessful();
// Vérifie que c'est du JSON-LD (standard API Platform)
$this->assertJsonContains([
'@type' => 'Collection',
]);
}
public function testGetRegion(): void
{
$region = RegionFactory::createOne();
$response = static::createClient()->request('GET', '/regions/' . $region->getId());
$this->assertResponseIsSuccessful();
$this->assertJsonContains([
'id' => $region->getId(),
]);
}
}
{
}
<?php
namespace App\tests\Api;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Factory\TaxeFactory;
class TaxeTest extends ApiTestCase
{
public function testGetTaxesCollection(): void
{
// Remplace '/api/taxes' par l'URL réelle de ta ressource API
$response = static::createClient()->request('GET', '/taxes');
$this->assertResponseIsSuccessful();
// Vérifie que c'est du JSON-LD (standard API Platform)
$this->assertJsonContains([
'@type' => 'Collection',
]);
}
public function testGetTaxe(): void
{
$taxe = TaxeFactory::createOne();
$response = static::createClient()->request('GET', '/taxes/' . $taxe->getId());
$this->assertResponseIsSuccessful();
$this->assertJsonContains([
'id' => $taxe->getId(),
]);
}
}
<?php
namespace App\tests\Api;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Factory\TypeTaxeFactory;
class TypeTaxeTest extends ApiTestCase
{
public function testGetTypeTaxeCollection(): void
{
// Remplace '/api/taxes' par l'URL réelle de ta ressource API
$response = static::createClient()->request('GET', '/type_taxes');
$this->assertResponseIsSuccessful();
// Vérifie que c'est du JSON-LD (standard API Platform)
$this->assertJsonContains([
'@type' => 'Collection',
]);
}
public function testGetTypeTaxe(): void
{
$typeTaxe = TypeTaxeFactory::createOne();
$response = static::createClient()->request('GET', '/type_taxes/' . $typeTaxe->getId());
$this->assertResponseIsSuccessful();
$this->assertJsonContains([
'id' => $typeTaxe->getId(),
]);
}
}
{
}