- 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;
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'));
}
->where('e.user=:userId')->setParameter('userId', $userId)
;
- return $qb->getQuery()->getSingleScalarResult();
+ return (int) $qb->getQuery()->getSingleScalarResult();
}
/**
->andWhere('t.id=:tagId')->setParameter('tagId', $tagId)
;
- return $qb->getQuery()->getSingleScalarResult();
+ return (int) $qb->getQuery()->getSingleScalarResult();
}
/**
$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']);
$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']);
}
$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']);
}
$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()
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertSame(true, $content['is_archived']);
+ $this->assertSame(1, $content['is_archived']);
}
public function testSaveIsStarredAfterPost()
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertSame(true, $content['is_starred']);
+ $this->assertSame(1, $content['is_starred']);
}
public function testSaveIsArchivedAfterPatch()
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertSame(true, $content['is_archived']);
+ $this->assertSame(1, $content['is_archived']);
}
public function testSaveIsStarredAfterPatch()
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertSame(true, $content['is_starred']);
+ $this->assertSame(1, $content['is_starred']);
}
public function dataForEntriesExistWithUrl()
$client = $this->getClient();
$client->request('GET', '/unread/list');
+ $this->assertSame(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$this->assertSame(200, $client->getResponse()->getStatusCode());
->getRepository('WallabagCoreBundle:Entry')
->find($entry->getId());
- $this->assertSame($res->isArchived(), true);
+ $this->assertSame(1, $res->isArchived());
}
public function testToggleStar()
->getRepository('WallabagCoreBundle:Entry')
->findOneById($entry->getId());
- $this->assertSame($res->isStarred(), true);
+ $this->assertSame(1, $res->isStarred());
}
public function testDelete()
$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);
}
],
'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',
$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']);
$listener->onInteractiveLogin($event);
- $this->assertSame('', $session->get('_locale'));
+ $this->assertNull($session->get('_locale'));
}
}
namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator;
-use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig;
use Graby\SiteConfig\SiteConfig as GrabySiteConfig;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
$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();
$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()