diff options
Diffstat (limited to 'src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php')
-rw-r--r-- | src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php | 88 |
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 | } |