diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-04-01 13:51:57 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-04-01 13:51:57 +0200 |
commit | 8a6456629814039cfc623cdb279bcba06dacff50 (patch) | |
tree | b3ae2459651b6ad085588fca0c624c6df554deb3 /tests/Wallabag/CoreBundle/Command | |
parent | 9c2b2aae70b06411336e6eb6ac43b3ebd30dc38c (diff) | |
download | wallabag-8a6456629814039cfc623cdb279bcba06dacff50.tar.gz wallabag-8a6456629814039cfc623cdb279bcba06dacff50.tar.zst wallabag-8a6456629814039cfc623cdb279bcba06dacff50.zip |
Use a better index for hashed_url
It'll most often be used in addition to the `user_id`.
Also, automatically generate the hash when saving the url.
Switch from `md5` to `sha1`.
Diffstat (limited to 'tests/Wallabag/CoreBundle/Command')
-rw-r--r-- | tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php b/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php index cc1e3fbc..17eed210 100644 --- a/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/GenerateUrlHashesCommandTest.php | |||
@@ -72,11 +72,8 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase | |||
72 | $entry1->setUrl($url); | 72 | $entry1->setUrl($url); |
73 | 73 | ||
74 | $em->persist($entry1); | 74 | $em->persist($entry1); |
75 | |||
76 | $em->flush(); | 75 | $em->flush(); |
77 | 76 | ||
78 | $this->assertNull($entry1->getHashedUrl()); | ||
79 | |||
80 | $application = new Application($this->getClient()->getKernel()); | 77 | $application = new Application($this->getClient()->getKernel()); |
81 | $application->add(new GenerateUrlHashesCommand()); | 78 | $application->add(new GenerateUrlHashesCommand()); |
82 | 79 | ||
@@ -92,7 +89,7 @@ class GenerateUrlHashesCommandTest extends WallabagCoreTestCase | |||
92 | 89 | ||
93 | $entry = $em->getRepository('WallabagCoreBundle:Entry')->findOneByUrl($url); | 90 | $entry = $em->getRepository('WallabagCoreBundle:Entry')->findOneByUrl($url); |
94 | 91 | ||
95 | $this->assertSame($entry->getHashedUrl(), hash('md5', $url)); | 92 | $this->assertSame($entry->getHashedUrl(), hash('sha1', $url)); |
96 | 93 | ||
97 | $query = $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.url = :url'); | 94 | $query = $em->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.url = :url'); |
98 | $query->setParameter('url', $url); | 95 | $query->setParameter('url', $url); |