mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-27 01:50:29 +00:00
Fix tests
This commit is contained in:
parent
f808b01692
commit
38520658ad
9 changed files with 34 additions and 39 deletions
|
@ -79,7 +79,7 @@ script:
|
|||
- echo "travis_fold:end:fixtures"
|
||||
|
||||
- if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi;
|
||||
- if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix src/ --verbose --dry-run ; fi;
|
||||
- if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix --verbose --dry-run ; fi;
|
||||
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi;
|
||||
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi;
|
||||
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/UserBundle/Resources/translations -v ; fi;
|
||||
|
|
|
@ -195,7 +195,7 @@ class EntryController extends Controller
|
|||
public function showUnreadAction(Request $request, $page)
|
||||
{
|
||||
// load the quickstart if no entry in database
|
||||
if ($page === 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId()) === 0) {
|
||||
if ((int) $page === 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId()) === 0) {
|
||||
return $this->redirect($this->generateUrl('quickstart'));
|
||||
}
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ class EntryRepository extends EntityRepository
|
|||
->where('e.user=:userId')->setParameter('userId', $userId)
|
||||
;
|
||||
|
||||
return $qb->getQuery()->getSingleScalarResult();
|
||||
return (int) $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -345,7 +345,7 @@ class EntryRepository extends EntityRepository
|
|||
->andWhere('t.id=:tagId')->setParameter('tagId', $tagId)
|
||||
;
|
||||
|
||||
return $qb->getQuery()->getSingleScalarResult();
|
||||
return (int) $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -405,8 +405,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$this->assertGreaterThan(0, $content['id']);
|
||||
$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']);
|
||||
$this->assertSame(false, $content['is_archived']);
|
||||
$this->assertSame(false, $content['is_starred']);
|
||||
$this->assertSame(0, $content['is_archived']);
|
||||
$this->assertSame(0, $content['is_starred']);
|
||||
$this->assertSame('New title for my article', $content['title']);
|
||||
$this->assertSame(1, $content['user_id']);
|
||||
$this->assertCount(2, $content['tags']);
|
||||
|
@ -433,8 +433,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$this->assertGreaterThan(0, $content['id']);
|
||||
$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']);
|
||||
$this->assertSame(true, $content['is_archived']);
|
||||
$this->assertSame(false, $content['is_starred']);
|
||||
$this->assertSame(1, $content['is_archived']);
|
||||
$this->assertSame(0, $content['is_starred']);
|
||||
$this->assertCount(3, $content['tags']);
|
||||
}
|
||||
|
||||
|
@ -485,8 +485,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$this->assertGreaterThan(0, $content['id']);
|
||||
$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']);
|
||||
$this->assertSame(true, $content['is_archived']);
|
||||
$this->assertSame(true, $content['is_starred']);
|
||||
$this->assertSame(1, $content['is_archived']);
|
||||
$this->assertSame(1, $content['is_starred']);
|
||||
$this->assertSame(1, $content['user_id']);
|
||||
}
|
||||
|
||||
|
@ -504,8 +504,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$this->assertGreaterThan(0, $content['id']);
|
||||
$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']);
|
||||
$this->assertSame(false, $content['is_archived']);
|
||||
$this->assertSame(true, $content['is_starred']);
|
||||
$this->assertSame(0, $content['is_archived']);
|
||||
$this->assertSame(1, $content['is_starred']);
|
||||
}
|
||||
|
||||
public function testPatchEntry()
|
||||
|
@ -691,7 +691,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$content = json_decode($this->client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertSame(true, $content['is_archived']);
|
||||
$this->assertSame(1, $content['is_archived']);
|
||||
}
|
||||
|
||||
public function testSaveIsStarredAfterPost()
|
||||
|
@ -713,7 +713,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$content = json_decode($this->client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertSame(true, $content['is_starred']);
|
||||
$this->assertSame(1, $content['is_starred']);
|
||||
}
|
||||
|
||||
public function testSaveIsArchivedAfterPatch()
|
||||
|
@ -735,7 +735,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$content = json_decode($this->client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertSame(true, $content['is_archived']);
|
||||
$this->assertSame(1, $content['is_archived']);
|
||||
}
|
||||
|
||||
public function testSaveIsStarredAfterPatch()
|
||||
|
@ -756,7 +756,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
$content = json_decode($this->client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertSame(true, $content['is_starred']);
|
||||
$this->assertSame(1, $content['is_starred']);
|
||||
}
|
||||
|
||||
public function dataForEntriesExistWithUrl()
|
||||
|
|
|
@ -43,6 +43,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$client = $this->getClient();
|
||||
|
||||
$client->request('GET', '/unread/list');
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
@ -505,7 +506,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->find($entry->getId());
|
||||
|
||||
$this->assertSame($res->isArchived(), true);
|
||||
$this->assertSame(1, $res->isArchived());
|
||||
}
|
||||
|
||||
public function testToggleStar()
|
||||
|
@ -528,7 +529,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findOneById($entry->getId());
|
||||
|
||||
$this->assertSame($res->isStarred(), true);
|
||||
$this->assertSame(1, $res->isStarred());
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
|
@ -1004,7 +1005,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
$this->assertSame($url, $entry->getUrl());
|
||||
$this->assertContains('Perpignan', $entry->getTitle());
|
||||
// instead of checking for the filename (which might change) check that the image is now local
|
||||
$this->assertContains('https://your-wallabag-url-instance.com/assets/images/', $entry->getContent());
|
||||
$this->assertContains($client->getContainer()->getParameter('domain_name') . '/assets/images/', $entry->getContent());
|
||||
|
||||
$client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
|
||||
}
|
||||
|
@ -1296,7 +1297,7 @@ class EntryControllerTest extends WallabagCoreTestCase
|
|||
],
|
||||
'fucked_list_of_languages' => [
|
||||
'http://geocatalog.webservice-energy.org/geonetwork/srv/eng/main.home',
|
||||
'',
|
||||
null,
|
||||
],
|
||||
'es-ES' => [
|
||||
'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google',
|
||||
|
|
|
@ -230,8 +230,8 @@ class ExportControllerTest extends WallabagCoreTestCase
|
|||
$this->assertArrayHasKey('created_at', $content[0]);
|
||||
$this->assertArrayHasKey('updated_at', $content[0]);
|
||||
|
||||
$this->assertSame($contentInDB->isArchived(), $content[0]['is_archived']);
|
||||
$this->assertSame($contentInDB->isStarred(), $content[0]['is_starred']);
|
||||
$this->assertSame((int) $contentInDB->isArchived(), $content[0]['is_archived']);
|
||||
$this->assertSame((int) $contentInDB->isStarred(), $content[0]['is_starred']);
|
||||
$this->assertSame($contentInDB->getTitle(), $content[0]['title']);
|
||||
$this->assertSame($contentInDB->getUrl(), $content[0]['url']);
|
||||
$this->assertSame([['text' => 'This is my annotation /o/', 'quote' => 'content']], $content[0]['annotations']);
|
||||
|
|
|
@ -53,6 +53,6 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$listener->onInteractiveLogin($event);
|
||||
|
||||
$this->assertSame('', $session->get('_locale'));
|
||||
$this->assertNull($session->get('_locale'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator;
|
||||
|
||||
use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig;
|
||||
use Graby\SiteConfig\SiteConfig as GrabySiteConfig;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
|
@ -68,20 +67,15 @@ class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$config = $this->builder->buildForHost('www.example.com');
|
||||
|
||||
$this->assertSame(
|
||||
new SiteConfig([
|
||||
'host' => 'example.com',
|
||||
'requiresLogin' => true,
|
||||
'loginUri' => 'http://www.example.com/login',
|
||||
'usernameField' => 'login',
|
||||
'passwordField' => 'password',
|
||||
'extraFields' => ['field' => 'value'],
|
||||
'notLoggedInXpath' => '//div[@class="need-login"]',
|
||||
'username' => 'foo',
|
||||
'password' => 'bar',
|
||||
]),
|
||||
$config
|
||||
);
|
||||
$this->assertSame('example.com', $config->getHost());
|
||||
$this->assertSame(true, $config->requiresLogin());
|
||||
$this->assertSame('http://www.example.com/login', $config->getLoginUri());
|
||||
$this->assertSame('login', $config->getUsernameField());
|
||||
$this->assertSame('password', $config->getPasswordField());
|
||||
$this->assertSame(['field' => 'value'], $config->getExtraFields());
|
||||
$this->assertSame('//div[@class="need-login"]', $config->getNotLoggedInXpath());
|
||||
$this->assertSame('foo', $config->getUsername());
|
||||
$this->assertSame('bar', $config->getPassword());
|
||||
|
||||
$records = $handler->getRecords();
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEmpty($entry->getMimetype());
|
||||
$this->assertEmpty($entry->getLanguage());
|
||||
$this->assertSame(0.0, $entry->getReadingTime());
|
||||
$this->assertSame(false, $entry->getDomainName());
|
||||
$this->assertSame(null, $entry->getDomainName());
|
||||
}
|
||||
|
||||
public function testWithEmptyContent()
|
||||
|
|
Loading…
Reference in a new issue