1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-17 17:08:37 +00:00

Add basic title edition

Fix #218
I mean basic, because there is no javascript at all. It could be a nice edit-in-place. But for the moment, it is simple.
This commit is contained in:
Jeremy Benoist 2015-06-02 18:54:34 +02:00
parent 51d9699fa1
commit 82d6d9cb06
8 changed files with 147 additions and 13 deletions

View file

@ -109,6 +109,54 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertContains($content->getTitle(), $client->getResponse()->getContent());
}
public function testEdit()
{
$this->logInAs('admin');
$client = $this->getClient();
$content = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->findOneByIsArchived(false);
$crawler = $client->request('GET', '/edit/'.$content->getId());
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertCount(1, $crawler->filter('input[id=entry_title]'));
$this->assertCount(1, $crawler->filter('button[id=entry_save]'));
}
public function testEditUpdate()
{
$this->logInAs('admin');
$client = $this->getClient();
$content = $client->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->findOneByIsArchived(false);
$crawler = $client->request('GET', '/edit/'.$content->getId());
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('button[type=submit]')->form();
$data = array(
'entry[title]' => 'My updated title hehe :)',
);
$client->submit($form, $data);
$this->assertEquals(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(array('_text')));
$this->assertContains('My updated title hehe :)', $alert[0]);
}
public function testToggleArchive()
{
$this->logInAs('admin');