Add a quick test

This commit is contained in:
Kévin Gomez 2015-11-13 21:23:39 +01:00
parent aeff8aa765
commit 958671a7ae
3 changed files with 44 additions and 1 deletions

View file

@ -6,6 +6,7 @@ use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\TaggingRule;
class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
{
@ -15,6 +16,13 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
public function load(ObjectManager $manager)
{
$adminConfig = new Config($this->getReference('admin-user'));
$taggingRule = new TaggingRule();
$taggingRule->setConfig($adminConfig);
$taggingRule->setRule('title matches "wallabag"');
$taggingRule->setTags(['wallabag']);
$manager->persist($taggingRule);
$adminConfig->setTheme('material');
$adminConfig->setItemsPerPage(30);
$adminConfig->setLanguage('en_US');

View file

@ -505,7 +505,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text')));
$this->assertContains('Tagging rules updated', $alert[0]);
$deleteLink = $crawler->filter('.delete')->eq(0)->link();
$deleteLink = $crawler->filter('.delete')->last()->link();
$crawler = $client->click($deleteLink);
$this->assertEquals(302, $client->getResponse()->getStatusCode());

View file

@ -102,6 +102,41 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertContains('Google', $alert[0]);
}
/**
* This test will require an internet connection.
*/
public function testPostNewThatWillBeTaggued()
{
$this->logInAs('admin');
$client = $this->getClient();
$crawler = $client->request('GET', '/new');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('button[type=submit]')->form();
$data = array(
'entry[url]' => $url = 'https://github.com/wallabag/wallabag',
);
$client->submit($form, $data);
$this->assertEquals(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$em = $client->getContainer()
->get('doctrine.orm.entity_manager');
$entry = $em
->getRepository('WallabagCoreBundle:Entry')
->findOneByUrl($url);
$this->assertCount(1, $entry->getTags());
$em->remove($entry);
$em->flush();
}
public function testArchive()
{
$this->logInAs('admin');