mirror of
https://github.com/wallabag/wallabag.git
synced 2026-10-09 20:49:20 +02:00
Introduces a fixtures/ directory at the repo root with seven Doctrine fixture classes (UserFixtures, ConfigFixtures, TagFixtures, TaggingRuleFixtures, IgnoreOriginUserRuleFixtures, EntryFixtures, AnnotationFixtures) under the Wallabag\Fixtures\ namespace. The fixture classes are registered as doctrine.fixture.orm services only in the dev environment. AppKernel loads services_dev.yml exclusively when the environment is dev, keeping the test environment completely unaffected. UserFixtures resolves an existing user from the database if one is present (install-command path) or creates a default wallabag/wallabag admin and dispatches USER_CREATED (standalone path, which triggers CreateConfigListener to set up the matching Config). ConfigFixtures follows the same pattern, finding or creating the Config record. EntryFixtures fetches each of 25 real wallabag-related URLs via ContentProxy so every entry is fully populated — title, content, language, reading time, domain, preview picture, and automatic tags applied by the configured TaggingRuleFixtures rules.
40 lines
971 B
PHP
40 lines
971 B
PHP
<?php
|
|
|
|
namespace Wallabag\Fixtures;
|
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
use Wallabag\Entity\Config;
|
|
use Wallabag\Entity\IgnoreOriginUserRule;
|
|
|
|
class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureInterface
|
|
{
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
$config = $this->getReference('dev-config', Config::class);
|
|
|
|
$rules = [
|
|
'host = "feedproxy.google.com"',
|
|
'host = "l.facebook.com"',
|
|
];
|
|
|
|
foreach ($rules as $ruleExpression) {
|
|
$rule = new IgnoreOriginUserRule();
|
|
$rule->setRule($ruleExpression);
|
|
$rule->setConfig($config);
|
|
|
|
$manager->persist($rule);
|
|
}
|
|
|
|
$manager->flush();
|
|
}
|
|
|
|
public function getDependencies(): array
|
|
{
|
|
return [
|
|
ConfigFixtures::class,
|
|
];
|
|
}
|
|
}
|