]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
Merge remote-tracking branch 'origin/master' into 2.4
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / DataFixtures / SiteCredentialFixtures.php
index c73173e8db808643bbe77f0d8f44491f1031b09b..9a7d116f60474ededa622af08d4d29510e227362 100644 (file)
@@ -5,20 +5,39 @@ namespace Wallabag\CoreBundle\DataFixtures;
 use Doctrine\Bundle\FixturesBundle\Fixture;
 use Doctrine\Common\DataFixtures\DependentFixtureInterface;
 use Doctrine\Common\Persistence\ObjectManager;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
 use Wallabag\CoreBundle\Entity\SiteCredential;
 use Wallabag\UserBundle\DataFixtures\UserFixtures;
 
-class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface
+class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface, ContainerAwareInterface
 {
+    /**
+     * @var ContainerInterface
+     */
+    private $container;
+
+    public function setContainer(ContainerInterface $container = null)
+    {
+        $this->container = $container;
+    }
+
     /**
      * {@inheritdoc}
      */
     public function load(ObjectManager $manager)
     {
         $credential = new SiteCredential($this->getReference('admin-user'));
-        $credential->setHost('example.com');
-        $credential->setUsername('foo');
-        $credential->setPassword('bar');
+        $credential->setHost('.super.com');
+        $credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('.super'));
+        $credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
+
+        $manager->persist($credential);
+
+        $credential = new SiteCredential($this->getReference('admin-user'));
+        $credential->setHost('paywall.example.com');
+        $credential->setUsername($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('paywall.example'));
+        $credential->setPassword($this->container->get('wallabag_core.helper.crypto_proxy')->crypt('bar'));
 
         $manager->persist($credential);