Skip to content
Snippets Groups Projects
Commit 16e4a0f3 authored by Fabrice Gangler's avatar Fabrice Gangler :art:
Browse files

test(fixture): add i18n organization description

parent 9259fd7a
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
namespace App\DataFixtures;
use App\Entity\Organization;
use App\Entity\OrganizationI18n;
use App\Entity\OrganizationType;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
......@@ -33,14 +34,31 @@ class AppOrganizationFixtures extends Fixture
];
public const ORGANIZATIONS = [
[
1 => [
'id' => 1, // must be identical to array key
'createdAt' => '2016-06-19 13:31:24',
'updatedAt' => '2025-01-25 14:22:05',
'type' => 'no_profit',
'name' => "ADULLACT",
'slug' => 'adullact',
'website' => 'https://adullact.org',
'oldComptoirId' => 999,
'description' => [
'fr' => "Association **des** ...\n"
. "- logiciel libre\n- numrérique libre",
'en' => 'No **profit** organization...',
],
],
2 => [
'id' => 2, // must be identical to array key
'createdAt' => '2022-06-19 13:31:24',
'updatedAt' => '2022-07-25 14:22:05',
'type' => 'public_sector',
'name' => "Mairie d'Abbeville",
'slug' => 'mairie-d-abbeville',
],
[
3 => [
'id' => 3, // must be identical to array key
'createdAt' => '2023-06-19 13:31:24',
'updatedAt' => '2023-07-25 14:22:05',
'type' => 'public_sector',
......@@ -80,6 +98,18 @@ public function load(ObjectManager $manager): void
}
$manager->persist($organization);
$manager->flush();
if (isset($data['description'])) {
foreach ($data['description'] as $locale => $text) {
$organizationI18n = new OrganizationI18n();
$organizationI18n->setOrganization($organization);
$organizationI18n->setLocale($locale);
$organizationI18n->setType(1);
$organizationI18n->setText($text);
$manager->persist($organizationI18n);
$manager->flush();
}
}
}
}
}
......@@ -76,7 +76,7 @@ public function testOneOrganizationPageAllowToTruncateUrlToRedirectToAllOrganiza
public function testOneOrganizationPageAllowToChangeLocaleInUrl(): void
{
$organizationId = AppOrganizationFixtures::ORGANIZATIONS[2]['id'];
$organizationId = AppOrganizationFixtures::ORGANIZATIONS[3]['id'];
$organizationSlug = AppOrganizationFixtures::ORGANIZATIONS[$organizationId]['slug'];
$client = static::createClient();
$this->checkRedirectionToNewUrl(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment