aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Tests/Controller
diff options
context:
space:
mode:
authorYuriy Evdokimov <rurik19@yandex.ru>2016-05-18 15:37:07 +0500
committerYuriy Evdokimov <rurik19@yandex.ru>2016-05-18 15:37:07 +0500
commitbba271e619eabbd525d38d125e4b77f838cadba5 (patch)
treebc275ea68365e72b6d4a42647ec2e6adcb8efb8e /src/Wallabag/ApiBundle/Tests/Controller
parent614a0bfd86fe392bd11f5866a9ff7a966e10198a (diff)
downloadwallabag-bba271e619eabbd525d38d125e4b77f838cadba5.tar.gz
wallabag-bba271e619eabbd525d38d125e4b77f838cadba5.tar.zst
wallabag-bba271e619eabbd525d38d125e4b77f838cadba5.zip
Tests for issue #2089
Diffstat (limited to 'src/Wallabag/ApiBundle/Tests/Controller')
-rw-r--r--src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
index 2f2d92ee..4c787277 100644
--- a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
+++ b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php
@@ -423,4 +423,92 @@ class WallabagRestControllerTest extends WallabagApiTestCase
423 423
424 $this->assertEquals($this->client->getContainer()->getParameter('wallabag_core.version'), $content); 424 $this->assertEquals($this->client->getContainer()->getParameter('wallabag_core.version'), $content);
425 } 425 }
426
427 public function testSaveIsArchivedAfterPost()
428 {
429 $entry = $this->client->getContainer()
430 ->get('doctrine.orm.entity_manager')
431 ->getRepository('WallabagCoreBundle:Entry')
432 ->findOneBy(['user' => 1, 'isArchived' => true]);
433
434 if (!$entry) {
435 $this->markTestSkipped('No content found in db.');
436 }
437
438 $this->client->request('POST', '/api/entries.json', [
439 'url' => $entry->getUrl(),
440 ]);
441
442 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
443
444 $content = json_decode($this->client->getResponse()->getContent(), true);
445
446 $this->assertEquals(true, $content['is_archived']);
447 }
448
449 public function testSaveIsStarredAfterPost()
450 {
451 $entry = $this->client->getContainer()
452 ->get('doctrine.orm.entity_manager')
453 ->getRepository('WallabagCoreBundle:Entry')
454 ->findOneBy(['user' => 1, 'isStarred' => true]);
455
456 if (!$entry) {
457 $this->markTestSkipped('No content found in db.');
458 }
459
460 $this->client->request('POST', '/api/entries.json', [
461 'url' => $entry->getUrl(),
462 ]);
463
464 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
465
466 $content = json_decode($this->client->getResponse()->getContent(), true);
467
468 $this->assertEquals(true, $content['is_starred']);
469 }
470
471 public function testSaveIsArchivedAfterPatch()
472 {
473 $entry = $this->client->getContainer()
474 ->get('doctrine.orm.entity_manager')
475 ->getRepository('WallabagCoreBundle:Entry')
476 ->findOneBy(['user' => 1, 'isArchived' => true]);
477
478 if (!$entry) {
479 $this->markTestSkipped('No content found in db.');
480 }
481
482 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [
483 'title' => $entry->getTitle().'++',
484 ]);
485
486 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
487
488 $content = json_decode($this->client->getResponse()->getContent(), true);
489
490 $this->assertEquals(true, $content['is_archived']);
491 }
492
493 public function testSaveIsStarredAfterPatch()
494 {
495 $entry = $this->client->getContainer()
496 ->get('doctrine.orm.entity_manager')
497 ->getRepository('WallabagCoreBundle:Entry')
498 ->findOneBy(['user' => 1, 'isStarred' => true]);
499
500 if (!$entry) {
501 $this->markTestSkipped('No content found in db.');
502 }
503 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [
504 'title' => $entry->getTitle().'++',
505 ]);
506
507 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
508
509 $content = json_decode($this->client->getResponse()->getContent(), true);
510
511 $this->assertEquals(true, $content['is_starred']);
512 }
513
426} 514}