}
// Just in case...
- if (count($ids) > 0) {
+ if (\count($ids) > 0) {
// Merge tags
$this->addSql('
UPDATE ' . $this->getTable('entry_tag') . '
->getDoctrine()
->getRepository('WallabagAnnotationBundle:Annotation')
->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId());
- $total = count($annotationRows);
+ $total = \count($annotationRows);
$annotations = ['total' => $total, 'rows' => $annotationRows];
$json = $this->get('jms_serializer')->serialize($annotations, 'json');
$order = $request->query->get('order', 'desc');
$page = (int) $request->query->get('page', 1);
$perPage = (int) $request->query->get('perPage', 30);
- $tags = is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', '');
+ $tags = \is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', '');
$since = $request->query->get('since', 0);
/** @var \Pagerfanta\Pagerfanta $pager */
$limit = $this->container->getParameter('wallabag_core.api_limit_mass_actions');
- if (count($urls) > $limit) {
+ if (\count($urls) > $limit) {
throw new HttpException(400, 'API limit reached');
}
'open_graph' => [
'og_image' => !empty($data['picture']) ? $data['picture'] : $entry->getPreviewPicture(),
],
- 'authors' => is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(),
+ 'authors' => \is_string($data['authors']) ? explode(',', $data['authors']) : $entry->getPublishedBy(),
]
);
} catch (\Exception $e) {
$contentProxy->updateLanguage($entry, $data['language']);
}
- if (!empty($data['authors']) && is_string($data['authors'])) {
+ if (!empty($data['authors']) && \is_string($data['authors'])) {
$entry->setPublishedBy(explode(',', $data['authors']));
}
*/
private function cleanOrphanTag($tags)
{
- if (!is_array($tags)) {
+ if (!\is_array($tags)) {
$tags = [$tags];
}
$em = $this->getDoctrine()->getManager();
foreach ($tags as $tag) {
- if (0 === count($tag->getEntries())) {
+ if (0 === \count($tag->getEntries())) {
$em->remove($tag);
}
}
} else {
$users = $this->getContainer()->get('wallabag_user.user_repository')->findAll();
- $this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', count($users)));
+ $this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
foreach ($users as $user) {
$this->io->text(sprintf('Processing user <info>%s</info>', $user->getUsername()));
$url = $this->similarUrl($entry['url']);
/* @var $entry Entry */
- if (in_array($url, $urls, true)) {
+ if (\in_array($url, $urls, true)) {
++$duplicatesCount;
$em->remove($repo->find($entry['id']));
private function similarUrl($url)
{
- if (in_array(substr($url, -1), ['/', '#'], true)) { // get rid of "/" and "#" and the end of urls
- return substr($url, 0, strlen($url));
+ if (\in_array(substr($url, -1), ['/', '#'], true)) { // get rid of "/" and "#" and the end of urls
+ return substr($url, 0, \strlen($url));
}
return $url;
->getQuery()
->getResult();
- $io->text(sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', count($entries), $user->getUserName()));
+ $io->text(sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', \count($entries), $user->getUserName()));
$filePath = $input->getArgument('filepath');
$status = '<info>OK!</info>';
$help = '';
- if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) {
+ if (!\extension_loaded($this->getContainer()->getParameter('database_driver'))) {
$fulfilled = false;
$status = '<error>ERROR!</error>';
$help = 'Database driver "' . $this->getContainer()->getParameter('database_driver') . '" is not installed.';
$status = '<info>OK!</info>';
$help = '';
- if (!function_exists($functionRequired)) {
+ if (!\function_exists($functionRequired)) {
$fulfilled = false;
$status = '<error>ERROR!</error>';
$help = 'You need the ' . $functionRequired . ' function activated';
}
try {
- return in_array($databaseName, $schemaManager->listDatabases(), true);
+ return \in_array($databaseName, $schemaManager->listDatabases(), true);
} catch (\Doctrine\DBAL\Exception\DriverException $e) {
// it means we weren't able to get database list, assume the database doesn't exist
{
$schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager();
- return count($schemaManager->listTableNames()) > 0 ? true : false;
+ return \count($schemaManager->listTableNames()) > 0 ? true : false;
}
}
$io->success(
sprintf(
'%s/%s%s user(s) displayed.',
- count($users),
+ \count($users),
$nbUsers,
null === $input->getArgument('search') ? '' : ' (filtered)'
)
$entryRepository = $this->getContainer()->get('wallabag_core.entry_repository');
$entryIds = $entryRepository->findAllEntriesIdByUserId($userId);
- $nbEntries = count($entryIds);
+ $nbEntries = \count($entryIds);
if (!$nbEntries) {
$io->success('No entry to reload.');
$em = $this->getDoctrine()->getManager();
foreach ($tags as $tag) {
- if (0 === count($tag->getEntries())) {
+ if (0 === \count($tag->getEntries())) {
$em->remove($tag);
}
}
$em->flush();
// remove orphan tag in case no entries are associated to it
- if (0 === count($tag->getEntries())) {
+ if (0 === \count($tag->getEntries())) {
$em->remove($tag);
$em->flush();
}
$this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null;
- if (null === $this->user || !is_object($this->user)) {
+ if (null === $this->user || !\is_object($this->user)) {
return;
}
}
->add('domainName', TextFilterType::class, [
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
$value = $values['value'];
- if (strlen($value) <= 2 || empty($value)) {
+ if (\strlen($value) <= 2 || empty($value)) {
return;
}
$expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->lower($filterQuery->getExpr()->literal('%' . $value . '%')));
*/
protected function processExtraFields($extraFieldsStrings)
{
- if (!is_array($extraFieldsStrings)) {
+ if (!\is_array($extraFieldsStrings)) {
return [];
}
(new LocaleConstraint())
);
- if (0 === count($errors)) {
+ if (0 === \count($errors)) {
$entry->setLanguage($value);
return;
(new UrlConstraint())
);
- if (0 === count($errors)) {
+ if (0 === \count($errors)) {
$entry->setPreviewPicture($value);
return;
$entry->setHttpStatus($content['status']);
}
- if (!empty($content['authors']) && is_array($content['authors'])) {
+ if (!empty($content['authors']) && \is_array($content['authors'])) {
$entry->setPublishedBy($content['authors']);
}
}
// if content is an image, define it as a preview too
- if (!empty($content['content_type']) && in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
+ if (!empty($content['content_type']) && \in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
$this->updatePreviewPicture($entry, $content['url']);
}
*/
private function mask($value)
{
- return strlen($value) > 0 ? $value[0] . '*****' . $value[strlen($value) - 1] : 'Empty value';
+ return \strlen($value) > 0 ? $value[0] . '*****' . $value[\strlen($value) - 1] : 'Empty value';
}
}
// Must be one or more digits followed by w OR x
$pattern = "/(?:[^\"'\s]+\s*(?:\d+[wx])+)/";
preg_match_all($pattern, $srcsetAttribute, $matches);
- $srcset = call_user_func_array('array_merge', $matches);
+ $srcset = \call_user_func_array('array_merge', $matches);
$srcsetUrls = array_map(function ($src) {
return trim(explode(' ', $src, 2)[0]);
}, $srcset);
$this->logger->debug('DownloadImages: Checking extension (alternative)', ['ext' => $ext]);
}
- if (!in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) {
+ if (!\in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) {
$this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping: ' . $imagePath);
return false;
*/
public function setEntries($entries)
{
- if (!is_array($entries)) {
+ if (!\is_array($entries)) {
$this->language = $entries->getLanguage();
$entries = [$entries];
}
{
$delimiter = ';';
$enclosure = '"';
- $handle = fopen('php://memory', 'rb+');
+ $handle = fopen('php://memory', 'b+r');
fputcsv($handle, ['Title', 'URL', 'Content', 'Tags', 'MIME Type', 'Language', 'Creation date'], $delimiter, $enclosure);
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
}
- if (null === $user || !is_object($user)) {
+ if (null === $user || !\is_object($user)) {
return;
}
{
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
- if (null === $user || !is_object($user)) {
+ if (null === $user || !\is_object($user)) {
return $url;
}
{
$tagsEntities = [];
- if (!is_array($tags)) {
+ if (!\is_array($tags)) {
$tags = explode(',', $tags);
}
$label = trim(mb_convert_case($label, MB_CASE_LOWER));
// avoid empty tag
- if (0 === strlen($label)) {
+ if (0 === \strlen($label)) {
continue;
}
{
// If there is no manager, this means that only Doctrine DBAL is configured
// In this case we can do nothing and just return
- if (null === $this->registry || !count($this->registry->getManagers())) {
+ if (null === $this->registry || !\count($this->registry->getManagers())) {
return false;
}
$qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since)));
}
- if (is_string($tags) && '' !== $tags) {
+ if (\is_string($tags) && '' !== $tags) {
foreach (explode(',', $tags) as $i => $tag) {
$entryAlias = 'e' . $i;
$tagAlias = 't' . $i;
->getQuery()
->getResult();
- if (count($res)) {
+ if (\count($res)) {
return current($res);
}
$query->setResultCacheLifetime($cacheLifeTime);
}
- return count($query->getArrayResult());
+ return \count($query->getArrayResult());
}
/**
*/
public static function getReadingTime($text)
{
- return floor(count(preg_split('~[^\p{L}\p{N}\']+~u', strip_tags($text))) / 200);
+ return floor(\count(preg_split('~[^\p{L}\p{N}\']+~u', strip_tags($text))) / 200);
}
}
{
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
- if (null === $user || !is_object($user)) {
+ if (null === $user || !\is_object($user)) {
return 0;
}
$query->useResultCache(true);
$query->setResultCacheLifetime($this->lifeTime);
- return count($query->getArrayResult());
+ return \count($query->getArrayResult());
}
/**
{
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
- if (null === $user || !is_object($user)) {
+ if (null === $user || !\is_object($user)) {
return 0;
}
{
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
- if (null === $user || !is_object($user)) {
+ if (null === $user || !\is_object($user)) {
return 0;
}
$query->useResultCache(true);
$query->setResultCacheLifetime($this->lifeTime);
- $nbArchives = count($query->getArrayResult());
+ $nbArchives = \count($query->getArrayResult());
$interval = $user->getCreatedAt()->diff(new \DateTime('now'));
$nbDays = (int) $interval->format('%a') ?: 1;
$user = $em->getRepository('WallabagUserBundle:User')->findOneByUsername($input->getArgument('username'));
}
- if (!is_object($user)) {
+ if (!\is_object($user)) {
throw new Exception(sprintf('User "%s" not found', $input->getArgument('username')));
}
$markAsRead = $form->get('mark_as_read')->getData();
$name = $this->getUser()->getId() . '.json';
- if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
+ if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
$res = $wallabag
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
->setMarkAsRead($markAsRead)
$markAsRead = $form->get('mark_as_read')->getData();
$name = 'instapaper_' . $this->getUser()->getId() . '.csv';
- if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
+ if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
$res = $instapaper
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
->setMarkAsRead($markAsRead)
$markAsRead = $form->get('mark_as_read')->getData();
$name = 'pinboard_' . $this->getUser()->getId() . '.json';
- if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
+ if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
$res = $pinboard
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
->setMarkAsRead($markAsRead)
$markAsRead = $form->get('mark_as_read')->getData();
$name = 'readability_' . $this->getUser()->getId() . '.json';
- if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
+ if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
$res = $readability
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
->setMarkAsRead($markAsRead)
$markAsRead = $form->get('mark_as_read')->getData();
$name = $this->getUser()->getId() . '.json';
- if (null !== $file && in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
+ if (null !== $file && \in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes'), true) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) {
$res = $wallabag
->setFilepath($this->getParameter('wallabag_import.resource_dir') . '/' . $name)
->setMarkAsRead($markAsRead)
*/
public function parseEntry(array $importedEntry)
{
- if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && is_array(reset($importedEntry))) {
+ if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) {
if ($this->producer) {
$this->parseEntriesForProducer($importedEntry);
}
$entries = [];
- $handle = fopen($this->filepath, 'r');
+ $handle = fopen($this->filepath, 'rb');
while (false !== ($data = fgetcsv($handle, 10240))) {
if ('URL' === $data[0]) {
continue;
// BUT it can also be the status (since status = folder in Instapaper)
// and we don't want archive, unread & starred to become a tag
$tags = null;
- if (false === in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) {
+ if (false === \in_array($data[3], ['Archive', 'Unread', 'Starred'], true)) {
$tags = [$data[3]];
}
// - first call get 5k offset 0
// - second call get 5k offset 5k
// - and so on
- if (self::NB_ELEMENTS === count($entries['list'])) {
+ if (self::NB_ELEMENTS === \count($entries['list'])) {
++$run;
return $this->import(self::NB_ELEMENTS * $run);
// In case of a bad fetch in v1, replace title and content with v2 error strings
// If fetching fails again, they will get this instead of the v1 strings
- if (in_array($entry['title'], $this->untitled, true)) {
+ if (\in_array($entry['title'], $this->untitled, true)) {
$data['title'] = $this->fetchingErrorMessageTitle;
$data['html'] = $this->fetchingErrorMessage;
}
$this->assertSame(200, $client->getResponse()->getStatusCode());
$newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll();
- $this->assertGreaterThan(count($nbClients), count($newNbClients));
+ $this->assertGreaterThan(\count($nbClients), \count($newNbClients));
$this->assertGreaterThan(1, $alert = $crawler->filter('.settings ul li strong')->extract(['_text']));
$this->assertContains('My app', $alert[0]);
$crawler = $client->request('GET', '/developer');
$this->assertSame(200, $client->getResponse()->getStatusCode());
- $this->assertSame(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count());
+ $this->assertSame(\count($nbClients), $crawler->filter('ul[class=collapsible] li')->count());
}
public function testDeveloperHowto()
$this->assertSame($entry->getTitle(), $content['title']);
$this->assertSame($entry->getUrl(), $content['url']);
- $this->assertCount(count($entry->getTags()), $content['tags']);
+ $this->assertCount(\count($entry->getTags()), $content['tags']);
$this->assertSame($entry->getUserName(), $content['user_name']);
$this->assertSame($entry->getUserEmail(), $content['user_email']);
$this->assertSame($entry->getUserId(), $content['user_id']);
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertGreaterThanOrEqual(1, count($content));
+ $this->assertGreaterThanOrEqual(1, \count($content));
$this->assertNotEmpty($content['_embedded']['items']);
$this->assertGreaterThanOrEqual(1, $content['total']);
$this->assertSame(1, $content['page']);
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertGreaterThanOrEqual(1, count($content));
+ $this->assertGreaterThanOrEqual(1, \count($content));
$this->assertArrayHasKey('items', $content['_embedded']);
$this->assertGreaterThanOrEqual(0, $content['total']);
$this->assertSame(1, $content['page']);
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertGreaterThanOrEqual(1, count($content));
+ $this->assertGreaterThanOrEqual(1, \count($content));
$this->assertArrayHasKey('items', $content['_embedded']);
$this->assertGreaterThanOrEqual(1, $content['total']);
$this->assertSame(1, $content['page']);
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertGreaterThanOrEqual(1, count($content));
+ $this->assertGreaterThanOrEqual(1, \count($content));
$this->assertNotEmpty($content['_embedded']['items']);
$this->assertGreaterThanOrEqual(1, $content['total']);
$this->assertSame(1, $content['page']);
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertGreaterThanOrEqual(1, count($content));
+ $this->assertGreaterThanOrEqual(1, \count($content));
$this->assertNotEmpty($content['_embedded']['items']);
$this->assertGreaterThanOrEqual(1, $content['total']);
$this->assertSame(1, $content['page']);
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertGreaterThanOrEqual(1, count($content));
+ $this->assertGreaterThanOrEqual(1, \count($content));
$this->assertNotEmpty($content['_embedded']['items']);
$this->assertGreaterThanOrEqual(1, $content['total']);
$this->assertSame(1, $content['page']);
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertGreaterThanOrEqual(1, count($content));
+ $this->assertGreaterThanOrEqual(1, \count($content));
$this->assertNotEmpty($content['_embedded']['items']);
$this->assertGreaterThanOrEqual(1, $content['total']);
$this->assertSame(1, $content['page']);
$content = json_decode($this->client->getResponse()->getContent(), true);
- $this->assertGreaterThanOrEqual(1, count($content));
+ $this->assertGreaterThanOrEqual(1, \count($content));
$this->assertEmpty($content['_embedded']['items']);
$this->assertSame(0, $content['total']);
$this->assertSame(1, $content['page']);
$this->assertSame($entry->getId(), $content['id']);
$this->assertSame($entry->getUrl(), $content['url']);
$this->assertSame('New awesome title', $content['title']);
- $this->assertGreaterThanOrEqual(1, count($content['tags']), 'We force only one tag');
+ $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag');
$this->assertSame(1, $content['user_id']);
$this->assertSame('de_AT', $content['language']);
$this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']);
$this->assertSame($entry->getId(), $content['id']);
$this->assertSame($entry->getUrl(), $content['url']);
- $this->assertGreaterThanOrEqual(1, count($content['tags']), 'We force only one tag');
+ $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag');
$this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string');
$this->assertSame($previousContent, $content['content'], 'Ensure content has not moved');
$this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved');
$this->markTestSkipped('No content found in db.');
}
- $nbTags = count($entry->getTags());
+ $nbTags = \count($entry->getTags());
$newTags = 'tag1,tag2,tag3';
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertArrayHasKey('tags', $content);
- $this->assertSame($nbTags + 3, count($content['tags']));
+ $this->assertSame($nbTags + 3, \count($content['tags']));
$entryDB = $this->client->getContainer()
->get('doctrine.orm.entity_manager')
}
// hydrate the tags relations
- $nbTags = count($entry->getTags());
+ $nbTags = \count($entry->getTags());
$tag = $entry->getTags()[0];
$this->client->request('DELETE', '/api/entries/' . $entry->getId() . '/tags/' . $tag->getId() . '.json');
$content = json_decode($this->client->getResponse()->getContent(), true);
$this->assertArrayHasKey('tags', $content);
- $this->assertSame($nbTags - 1, count($content['tags']));
+ $this->assertSame($nbTags - 1, \count($content['tags']));
}
public function testSaveIsArchivedAfterPost()
$this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
$this->assertContains('My updated title hehe :)', $title[0]);
- $this->assertSame(1, count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])));
+ $this->assertSame(1, \count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])));
$this->assertNotContains('example.io', trim($stats[0]));
}
$this->assertGreaterThan(1, $csv);
// +1 for title line
- $this->assertSame(count($contentInDB) + 1, count($csv));
+ $this->assertSame(\count($contentInDB) + 1, \count($csv));
$this->assertSame('Title;URL;Content;Tags;"MIME Type";Language;"Creation date"', $csv[0]);
$this->assertContains($contentInDB[0]['title'], $csv[1]);
$this->assertContains($contentInDB[0]['url'], $csv[1]);
$content = new \SimpleXMLElement($client->getResponse()->getContent());
$this->assertGreaterThan(0, $content->count());
- $this->assertSame(count($contentInDB), $content->count());
+ $this->assertSame(\count($contentInDB), $content->count());
$this->assertNotEmpty('id', (string) $content->entry[0]->id);
$this->assertNotEmpty('title', (string) $content->entry[0]->title);
$this->assertNotEmpty('url', (string) $content->entry[0]->url);
$tags[$key] = $tag->getLabel();
}
- $this->assertGreaterThanOrEqual(2, count($tags));
+ $this->assertGreaterThanOrEqual(2, \count($tags));
$this->assertNotFalse(array_search('foo2', $tags, true), 'Tag foo2 is assigned to the entry');
$this->assertNotFalse(array_search('bar2', $tags, true), 'Tag bar2 is assigned to the entry');
}
$this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok');
$this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok');
- $this->assertSame(1, count($content->getTags()));
+ $this->assertSame(1, \count($content->getTags()));
$createdAt = $content->getCreatedAt();
$this->assertSame('2011', $createdAt->format('Y'));
$this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok');
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok');
$this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok');
- $this->assertSame(3, count($content->getTags()));
+ $this->assertSame(3, \count($content->getTags()));
$content = $client->getContainer()
->get('doctrine.orm.entity_manager')
$this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok');
$this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok');
$this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag');
- $this->assertSame(1, count($content->getTags()));
+ $this->assertSame(1, \count($content->getTags()));
$this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
$content = $client->getContainer()
$this->assertContains('foot', $content->getTags());
$this->assertContains('test_tag', $content->getTags());
- $this->assertSame(2, count($content->getTags()));
+ $this->assertSame(2, \count($content->getTags()));
}
public function testImportInstapaperWithFileAndMarkAllAsRead()
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
$this->assertContains('varnish', $tags, 'It includes the "varnish" tag');
$this->assertContains('php', $tags, 'It includes the "php" tag');
- $this->assertSame(3, count($tags));
+ $this->assertSame(3, \count($tags));
$this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
$this->assertSame('2016-10-26', $content->getCreatedAt()->format('Y-m-d'));
$tags = $content->getTags();
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
- $this->assertSame(1, count($tags));
+ $this->assertSame(1, \count($tags));
$this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
$this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
$tags = $content->getTags();
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
$this->assertContains('framabag', $tags, 'It includes the "framabag" tag');
- $this->assertSame(2, count($tags));
+ $this->assertSame(2, \count($tags));
$this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
}
$tags = $content->getTags();
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
- $this->assertSame(1, count($tags));
+ $this->assertSame(1, \count($tags));
$content = $client->getContainer()
->get('doctrine.orm.entity_manager')
$this->assertContains('foot', $tags, 'It includes the "foot" tag');
$this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag');
$this->assertContains('blog', $tags, 'It includes the "blog" tag');
- $this->assertSame(3, count($tags));
+ $this->assertSame(3, \count($tags));
$this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
$this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
{
public function count()
{
- return count($this->messages);
+ return \count($this->messages);
}
public function getMessages()