diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 067aed2c..35a21afc 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | |||
@@ -32,6 +32,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
32 | $this->assertEquals($entry->getUserName(), $content['user_name']); | 32 | $this->assertEquals($entry->getUserName(), $content['user_name']); |
33 | $this->assertEquals($entry->getUserEmail(), $content['user_email']); | 33 | $this->assertEquals($entry->getUserEmail(), $content['user_email']); |
34 | $this->assertEquals($entry->getUserId(), $content['user_id']); | 34 | $this->assertEquals($entry->getUserId(), $content['user_id']); |
35 | $this->assertEquals($entry->getProgress(), $content['progress']); | ||
35 | 36 | ||
36 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); | 37 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); |
37 | } | 38 | } |
@@ -417,6 +418,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
417 | $this->assertContains('bob', $content['published_by']); | 418 | $this->assertContains('bob', $content['published_by']); |
418 | $this->assertContains('helen', $content['published_by']); | 419 | $this->assertContains('helen', $content['published_by']); |
419 | $this->assertTrue($content['is_public'], 'A public link has been generated for that entry'); | 420 | $this->assertTrue($content['is_public'], 'A public link has been generated for that entry'); |
421 | $this->assertEquals(0, $content['progress']); | ||
420 | } | 422 | } |
421 | 423 | ||
422 | public function testPostSameEntry() | 424 | public function testPostSameEntry() |
@@ -532,6 +534,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
532 | 'authors' => 'bob,sponge', | 534 | 'authors' => 'bob,sponge', |
533 | 'content' => 'awesome', | 535 | 'content' => 'awesome', |
534 | 'public' => 0, | 536 | 'public' => 0, |
537 | 'progress' => '70', | ||
535 | ]); | 538 | ]); |
536 | 539 | ||
537 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | 540 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
@@ -549,6 +552,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
549 | $this->assertContains('bob', $content['published_by']); | 552 | $this->assertContains('bob', $content['published_by']); |
550 | $this->assertEquals('awesome', $content['content']); | 553 | $this->assertEquals('awesome', $content['content']); |
551 | $this->assertFalse($content['is_public'], 'Entry is no more shared'); | 554 | $this->assertFalse($content['is_public'], 'Entry is no more shared'); |
555 | $this->assertEquals(70, $content['progress']); | ||
552 | } | 556 | } |
553 | 557 | ||
554 | public function testPatchEntryWithoutQuotes() | 558 | public function testPatchEntryWithoutQuotes() |
@@ -759,6 +763,28 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
759 | $this->assertEquals(true, $content['is_starred']); | 763 | $this->assertEquals(true, $content['is_starred']); |
760 | } | 764 | } |
761 | 765 | ||
766 | public function testChangeProgress() | ||
767 | { | ||
768 | $entry = $this->client->getContainer() | ||
769 | ->get('doctrine.orm.entity_manager') | ||
770 | ->getRepository('WallabagCoreBundle:Entry') | ||
771 | ->findOneByUser(1); | ||
772 | |||
773 | if (!$entry) { | ||
774 | $this->markTestSkipped('No content found in db.'); | ||
775 | } | ||
776 | |||
777 | $this->client->request('PATCH', '/api/entries/'.$entry->getId().'json', [ | ||
778 | 'progress' => 69, | ||
779 | ]); | ||
780 | |||
781 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
782 | |||
783 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
784 | |||
785 | $this->assertEquals(69, $content['progress']); | ||
786 | } | ||
787 | |||
762 | public function testGetEntriesExists() | 788 | public function testGetEntriesExists() |
763 | { | 789 | { |
764 | $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2'); | 790 | $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2'); |