diff options
9 files changed, 34 insertions, 39 deletions
diff --git a/.travis.yml b/.travis.yml index e6cf96cb..60e7dd1c 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -79,7 +79,7 @@ script: | |||
79 | - echo "travis_fold:end:fixtures" | 79 | - echo "travis_fold:end:fixtures" |
80 | 80 | ||
81 | - if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi; | 81 | - if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi; |
82 | - if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix src/ --verbose --dry-run ; fi; | 82 | - if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix --verbose --dry-run ; fi; |
83 | - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi; | 83 | - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi; |
84 | - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi; | 84 | - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi; |
85 | - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/UserBundle/Resources/translations -v ; fi; | 85 | - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/UserBundle/Resources/translations -v ; fi; |
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 445cfeeb..845ebef6 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -195,7 +195,7 @@ class EntryController extends Controller | |||
195 | public function showUnreadAction(Request $request, $page) | 195 | public function showUnreadAction(Request $request, $page) |
196 | { | 196 | { |
197 | // load the quickstart if no entry in database | 197 | // load the quickstart if no entry in database |
198 | if ($page === 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId()) === 0) { | 198 | if ((int) $page === 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId()) === 0) { |
199 | return $this->redirect($this->generateUrl('quickstart')); | 199 | return $this->redirect($this->generateUrl('quickstart')); |
200 | } | 200 | } |
201 | 201 | ||
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index a65bfe3b..c27ee90c 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -325,7 +325,7 @@ class EntryRepository extends EntityRepository | |||
325 | ->where('e.user=:userId')->setParameter('userId', $userId) | 325 | ->where('e.user=:userId')->setParameter('userId', $userId) |
326 | ; | 326 | ; |
327 | 327 | ||
328 | return $qb->getQuery()->getSingleScalarResult(); | 328 | return (int) $qb->getQuery()->getSingleScalarResult(); |
329 | } | 329 | } |
330 | 330 | ||
331 | /** | 331 | /** |
@@ -345,7 +345,7 @@ class EntryRepository extends EntityRepository | |||
345 | ->andWhere('t.id=:tagId')->setParameter('tagId', $tagId) | 345 | ->andWhere('t.id=:tagId')->setParameter('tagId', $tagId) |
346 | ; | 346 | ; |
347 | 347 | ||
348 | return $qb->getQuery()->getSingleScalarResult(); | 348 | return (int) $qb->getQuery()->getSingleScalarResult(); |
349 | } | 349 | } |
350 | 350 | ||
351 | /** | 351 | /** |
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 2a333a0d..ae4af4cd 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | |||
@@ -405,8 +405,8 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
405 | 405 | ||
406 | $this->assertGreaterThan(0, $content['id']); | 406 | $this->assertGreaterThan(0, $content['id']); |
407 | $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); | 407 | $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); |
408 | $this->assertSame(false, $content['is_archived']); | 408 | $this->assertSame(0, $content['is_archived']); |
409 | $this->assertSame(false, $content['is_starred']); | 409 | $this->assertSame(0, $content['is_starred']); |
410 | $this->assertSame('New title for my article', $content['title']); | 410 | $this->assertSame('New title for my article', $content['title']); |
411 | $this->assertSame(1, $content['user_id']); | 411 | $this->assertSame(1, $content['user_id']); |
412 | $this->assertCount(2, $content['tags']); | 412 | $this->assertCount(2, $content['tags']); |
@@ -433,8 +433,8 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
433 | 433 | ||
434 | $this->assertGreaterThan(0, $content['id']); | 434 | $this->assertGreaterThan(0, $content['id']); |
435 | $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); | 435 | $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); |
436 | $this->assertSame(true, $content['is_archived']); | 436 | $this->assertSame(1, $content['is_archived']); |
437 | $this->assertSame(false, $content['is_starred']); | 437 | $this->assertSame(0, $content['is_starred']); |
438 | $this->assertCount(3, $content['tags']); | 438 | $this->assertCount(3, $content['tags']); |
439 | } | 439 | } |
440 | 440 | ||
@@ -485,8 +485,8 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
485 | 485 | ||
486 | $this->assertGreaterThan(0, $content['id']); | 486 | $this->assertGreaterThan(0, $content['id']); |
487 | $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); | 487 | $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); |
488 | $this->assertSame(true, $content['is_archived']); | 488 | $this->assertSame(1, $content['is_archived']); |
489 | $this->assertSame(true, $content['is_starred']); | 489 | $this->assertSame(1, $content['is_starred']); |
490 | $this->assertSame(1, $content['user_id']); | 490 | $this->assertSame(1, $content['user_id']); |
491 | } | 491 | } |
492 | 492 | ||
@@ -504,8 +504,8 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
504 | 504 | ||
505 | $this->assertGreaterThan(0, $content['id']); | 505 | $this->assertGreaterThan(0, $content['id']); |
506 | $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); | 506 | $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); |
507 | $this->assertSame(false, $content['is_archived']); | 507 | $this->assertSame(0, $content['is_archived']); |
508 | $this->assertSame(true, $content['is_starred']); | 508 | $this->assertSame(1, $content['is_starred']); |
509 | } | 509 | } |
510 | 510 | ||
511 | public function testPatchEntry() | 511 | public function testPatchEntry() |
@@ -691,7 +691,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
691 | 691 | ||
692 | $content = json_decode($this->client->getResponse()->getContent(), true); | 692 | $content = json_decode($this->client->getResponse()->getContent(), true); |
693 | 693 | ||
694 | $this->assertSame(true, $content['is_archived']); | 694 | $this->assertSame(1, $content['is_archived']); |
695 | } | 695 | } |
696 | 696 | ||
697 | public function testSaveIsStarredAfterPost() | 697 | public function testSaveIsStarredAfterPost() |
@@ -713,7 +713,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
713 | 713 | ||
714 | $content = json_decode($this->client->getResponse()->getContent(), true); | 714 | $content = json_decode($this->client->getResponse()->getContent(), true); |
715 | 715 | ||
716 | $this->assertSame(true, $content['is_starred']); | 716 | $this->assertSame(1, $content['is_starred']); |
717 | } | 717 | } |
718 | 718 | ||
719 | public function testSaveIsArchivedAfterPatch() | 719 | public function testSaveIsArchivedAfterPatch() |
@@ -735,7 +735,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
735 | 735 | ||
736 | $content = json_decode($this->client->getResponse()->getContent(), true); | 736 | $content = json_decode($this->client->getResponse()->getContent(), true); |
737 | 737 | ||
738 | $this->assertSame(true, $content['is_archived']); | 738 | $this->assertSame(1, $content['is_archived']); |
739 | } | 739 | } |
740 | 740 | ||
741 | public function testSaveIsStarredAfterPatch() | 741 | public function testSaveIsStarredAfterPatch() |
@@ -756,7 +756,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
756 | 756 | ||
757 | $content = json_decode($this->client->getResponse()->getContent(), true); | 757 | $content = json_decode($this->client->getResponse()->getContent(), true); |
758 | 758 | ||
759 | $this->assertSame(true, $content['is_starred']); | 759 | $this->assertSame(1, $content['is_starred']); |
760 | } | 760 | } |
761 | 761 | ||
762 | public function dataForEntriesExistWithUrl() | 762 | public function dataForEntriesExistWithUrl() |
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index b528bcdb..b1c6d53c 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -43,6 +43,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
43 | $client = $this->getClient(); | 43 | $client = $this->getClient(); |
44 | 44 | ||
45 | $client->request('GET', '/unread/list'); | 45 | $client->request('GET', '/unread/list'); |
46 | $this->assertSame(302, $client->getResponse()->getStatusCode()); | ||
46 | $crawler = $client->followRedirect(); | 47 | $crawler = $client->followRedirect(); |
47 | 48 | ||
48 | $this->assertSame(200, $client->getResponse()->getStatusCode()); | 49 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
@@ -505,7 +506,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
505 | ->getRepository('WallabagCoreBundle:Entry') | 506 | ->getRepository('WallabagCoreBundle:Entry') |
506 | ->find($entry->getId()); | 507 | ->find($entry->getId()); |
507 | 508 | ||
508 | $this->assertSame($res->isArchived(), true); | 509 | $this->assertSame(1, $res->isArchived()); |
509 | } | 510 | } |
510 | 511 | ||
511 | public function testToggleStar() | 512 | public function testToggleStar() |
@@ -528,7 +529,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
528 | ->getRepository('WallabagCoreBundle:Entry') | 529 | ->getRepository('WallabagCoreBundle:Entry') |
529 | ->findOneById($entry->getId()); | 530 | ->findOneById($entry->getId()); |
530 | 531 | ||
531 | $this->assertSame($res->isStarred(), true); | 532 | $this->assertSame(1, $res->isStarred()); |
532 | } | 533 | } |
533 | 534 | ||
534 | public function testDelete() | 535 | public function testDelete() |
@@ -1004,7 +1005,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1004 | $this->assertSame($url, $entry->getUrl()); | 1005 | $this->assertSame($url, $entry->getUrl()); |
1005 | $this->assertContains('Perpignan', $entry->getTitle()); | 1006 | $this->assertContains('Perpignan', $entry->getTitle()); |
1006 | // instead of checking for the filename (which might change) check that the image is now local | 1007 | // instead of checking for the filename (which might change) check that the image is now local |
1007 | $this->assertContains('https://your-wallabag-url-instance.com/assets/images/', $entry->getContent()); | 1008 | $this->assertContains($client->getContainer()->getParameter('domain_name') . '/assets/images/', $entry->getContent()); |
1008 | 1009 | ||
1009 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); | 1010 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); |
1010 | } | 1011 | } |
@@ -1296,7 +1297,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1296 | ], | 1297 | ], |
1297 | 'fucked_list_of_languages' => [ | 1298 | 'fucked_list_of_languages' => [ |
1298 | 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home', | 1299 | 'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home', |
1299 | '', | 1300 | null, |
1300 | ], | 1301 | ], |
1301 | 'es-ES' => [ | 1302 | 'es-ES' => [ |
1302 | 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google', | 1303 | 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google', |
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index ba9296af..3e216381 100644 --- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php | |||
@@ -230,8 +230,8 @@ class ExportControllerTest extends WallabagCoreTestCase | |||
230 | $this->assertArrayHasKey('created_at', $content[0]); | 230 | $this->assertArrayHasKey('created_at', $content[0]); |
231 | $this->assertArrayHasKey('updated_at', $content[0]); | 231 | $this->assertArrayHasKey('updated_at', $content[0]); |
232 | 232 | ||
233 | $this->assertSame($contentInDB->isArchived(), $content[0]['is_archived']); | 233 | $this->assertSame((int) $contentInDB->isArchived(), $content[0]['is_archived']); |
234 | $this->assertSame($contentInDB->isStarred(), $content[0]['is_starred']); | 234 | $this->assertSame((int) $contentInDB->isStarred(), $content[0]['is_starred']); |
235 | $this->assertSame($contentInDB->getTitle(), $content[0]['title']); | 235 | $this->assertSame($contentInDB->getTitle(), $content[0]['title']); |
236 | $this->assertSame($contentInDB->getUrl(), $content[0]['url']); | 236 | $this->assertSame($contentInDB->getUrl(), $content[0]['url']); |
237 | $this->assertSame([['text' => 'This is my annotation /o/', 'quote' => 'content']], $content[0]['annotations']); | 237 | $this->assertSame([['text' => 'This is my annotation /o/', 'quote' => 'content']], $content[0]['annotations']); |
diff --git a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php index 91ce0102..5ffe1ca6 100644 --- a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php | |||
@@ -53,6 +53,6 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
53 | 53 | ||
54 | $listener->onInteractiveLogin($event); | 54 | $listener->onInteractiveLogin($event); |
55 | 55 | ||
56 | $this->assertSame('', $session->get('_locale')); | 56 | $this->assertNull($session->get('_locale')); |
57 | } | 57 | } |
58 | } | 58 | } |
diff --git a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php index 85036e35..5d6a29fe 100644 --- a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php +++ b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator; | 3 | namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator; |
4 | 4 | ||
5 | use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; | ||
6 | use Graby\SiteConfig\SiteConfig as GrabySiteConfig; | 5 | use Graby\SiteConfig\SiteConfig as GrabySiteConfig; |
7 | use Monolog\Handler\TestHandler; | 6 | use Monolog\Handler\TestHandler; |
8 | use Monolog\Logger; | 7 | use Monolog\Logger; |
@@ -68,20 +67,15 @@ class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase | |||
68 | 67 | ||
69 | $config = $this->builder->buildForHost('www.example.com'); | 68 | $config = $this->builder->buildForHost('www.example.com'); |
70 | 69 | ||
71 | $this->assertSame( | 70 | $this->assertSame('example.com', $config->getHost()); |
72 | new SiteConfig([ | 71 | $this->assertSame(true, $config->requiresLogin()); |
73 | 'host' => 'example.com', | 72 | $this->assertSame('http://www.example.com/login', $config->getLoginUri()); |
74 | 'requiresLogin' => true, | 73 | $this->assertSame('login', $config->getUsernameField()); |
75 | 'loginUri' => 'http://www.example.com/login', | 74 | $this->assertSame('password', $config->getPasswordField()); |
76 | 'usernameField' => 'login', | 75 | $this->assertSame(['field' => 'value'], $config->getExtraFields()); |
77 | 'passwordField' => 'password', | 76 | $this->assertSame('//div[@class="need-login"]', $config->getNotLoggedInXpath()); |
78 | 'extraFields' => ['field' => 'value'], | 77 | $this->assertSame('foo', $config->getUsername()); |
79 | 'notLoggedInXpath' => '//div[@class="need-login"]', | 78 | $this->assertSame('bar', $config->getPassword()); |
80 | 'username' => 'foo', | ||
81 | 'password' => 'bar', | ||
82 | ]), | ||
83 | $config | ||
84 | ); | ||
85 | 79 | ||
86 | $records = $handler->getRecords(); | 80 | $records = $handler->getRecords(); |
87 | 81 | ||
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 7e19631b..c63671c4 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | |||
@@ -51,7 +51,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
51 | $this->assertEmpty($entry->getMimetype()); | 51 | $this->assertEmpty($entry->getMimetype()); |
52 | $this->assertEmpty($entry->getLanguage()); | 52 | $this->assertEmpty($entry->getLanguage()); |
53 | $this->assertSame(0.0, $entry->getReadingTime()); | 53 | $this->assertSame(0.0, $entry->getReadingTime()); |
54 | $this->assertSame(false, $entry->getDomainName()); | 54 | $this->assertSame(null, $entry->getDomainName()); |
55 | } | 55 | } |
56 | 56 | ||
57 | public function testWithEmptyContent() | 57 | public function testWithEmptyContent() |