diff options
author | Kévin Gomez <contact@kevingomez.fr> | 2015-11-13 21:23:39 +0100 |
---|---|---|
committer | Kévin Gomez <contact@kevingomez.fr> | 2015-11-13 22:53:28 +0100 |
commit | 958671a7ae2f19c4b919ed4ba0161e7d300411b4 (patch) | |
tree | ec1c31c0c8dd8638c961f12a37e7fa58732c063b /src/Wallabag/CoreBundle | |
parent | aeff8aa765579259c1427dc469ff78ebdebfc72c (diff) | |
download | wallabag-958671a7ae2f19c4b919ed4ba0161e7d300411b4.tar.gz wallabag-958671a7ae2f19c4b919ed4ba0161e7d300411b4.tar.zst wallabag-958671a7ae2f19c4b919ed4ba0161e7d300411b4.zip |
Add a quick test
Diffstat (limited to 'src/Wallabag/CoreBundle')
3 files changed, 44 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php index cb0c52c4..84b78a89 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php | |||
@@ -6,6 +6,7 @@ use Doctrine\Common\DataFixtures\AbstractFixture; | |||
6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | 6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; |
7 | use Doctrine\Common\Persistence\ObjectManager; | 7 | use Doctrine\Common\Persistence\ObjectManager; |
8 | use Wallabag\CoreBundle\Entity\Config; | 8 | use Wallabag\CoreBundle\Entity\Config; |
9 | use Wallabag\CoreBundle\Entity\TaggingRule; | ||
9 | 10 | ||
10 | class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface | 11 | class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface |
11 | { | 12 | { |
@@ -15,6 +16,13 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface | |||
15 | public function load(ObjectManager $manager) | 16 | public function load(ObjectManager $manager) |
16 | { | 17 | { |
17 | $adminConfig = new Config($this->getReference('admin-user')); | 18 | $adminConfig = new Config($this->getReference('admin-user')); |
19 | $taggingRule = new TaggingRule(); | ||
20 | |||
21 | $taggingRule->setConfig($adminConfig); | ||
22 | $taggingRule->setRule('title matches "wallabag"'); | ||
23 | $taggingRule->setTags(['wallabag']); | ||
24 | $manager->persist($taggingRule); | ||
25 | |||
18 | $adminConfig->setTheme('material'); | 26 | $adminConfig->setTheme('material'); |
19 | $adminConfig->setItemsPerPage(30); | 27 | $adminConfig->setItemsPerPage(30); |
20 | $adminConfig->setLanguage('en_US'); | 28 | $adminConfig->setLanguage('en_US'); |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index 4eb67ffd..7b32354f 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | |||
@@ -505,7 +505,7 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
505 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); | 505 | $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); |
506 | $this->assertContains('Tagging rules updated', $alert[0]); | 506 | $this->assertContains('Tagging rules updated', $alert[0]); |
507 | 507 | ||
508 | $deleteLink = $crawler->filter('.delete')->eq(0)->link(); | 508 | $deleteLink = $crawler->filter('.delete')->last()->link(); |
509 | 509 | ||
510 | $crawler = $client->click($deleteLink); | 510 | $crawler = $client->click($deleteLink); |
511 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | 511 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 56b4c9e4..9f2bcd6c 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -102,6 +102,41 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
102 | $this->assertContains('Google', $alert[0]); | 102 | $this->assertContains('Google', $alert[0]); |
103 | } | 103 | } |
104 | 104 | ||
105 | /** | ||
106 | * This test will require an internet connection. | ||
107 | */ | ||
108 | public function testPostNewThatWillBeTaggued() | ||
109 | { | ||
110 | $this->logInAs('admin'); | ||
111 | $client = $this->getClient(); | ||
112 | |||
113 | $crawler = $client->request('GET', '/new'); | ||
114 | |||
115 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
116 | |||
117 | $form = $crawler->filter('button[type=submit]')->form(); | ||
118 | |||
119 | $data = array( | ||
120 | 'entry[url]' => $url = 'https://github.com/wallabag/wallabag', | ||
121 | ); | ||
122 | |||
123 | $client->submit($form, $data); | ||
124 | |||
125 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
126 | |||
127 | $crawler = $client->followRedirect(); | ||
128 | |||
129 | $em = $client->getContainer() | ||
130 | ->get('doctrine.orm.entity_manager'); | ||
131 | $entry = $em | ||
132 | ->getRepository('WallabagCoreBundle:Entry') | ||
133 | ->findOneByUrl($url); | ||
134 | $this->assertCount(1, $entry->getTags()); | ||
135 | |||
136 | $em->remove($entry); | ||
137 | $em->flush(); | ||
138 | } | ||
139 | |||
105 | public function testArchive() | 140 | public function testArchive() |
106 | { | 141 | { |
107 | $this->logInAs('admin'); | 142 | $this->logInAs('admin'); |