- 5.6
- 7.0
- 7.1
+ - 7.2
- nightly
node_js:
- php: 7.0
env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite
allow_failures:
+ - php: 7.2
- php: nightly
# exclude v1 branches
{
return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username);
}
-
- private function getDoctrine()
- {
- return $this->getContainer()->get('doctrine');
- }
}
return 0;
}
-
- private function getDoctrine()
- {
- return $this->getContainer()->get('doctrine');
- }
}
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
-use Wallabag\CoreBundle\Entity\Config;
class InstallCommand extends ContainerAwareCommand
{
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\UserBundle\Entity\User;
class ShowUserCommand extends ContainerAwareCommand
{
- /** @var OutputInterface */
- protected $output;
+ /** @var SymfonyStyle */
+ protected $io;
protected function configure()
{
protected function execute(InputInterface $input, OutputInterface $output)
{
- $this->output = $output;
+ $this->io = new SymfonyStyle($input, $output);
$username = $input->getArgument('username');
$user = $this->getUser($username);
$this->showUser($user);
} catch (NoResultException $e) {
- $output->writeln(sprintf('<error>User "%s" not found.</error>', $username));
+ $this->io->error(sprintf('User "%s" not found.', $username));
return 1;
}
*/
private function showUser(User $user)
{
- $this->output->writeln(sprintf('Username : %s', $user->getUsername()));
- $this->output->writeln(sprintf('Email : %s', $user->getEmail()));
- $this->output->writeln(sprintf('Display name : %s', $user->getName()));
- $this->output->writeln(sprintf('Creation date : %s', $user->getCreatedAt()->format('Y-m-d H:i:s')));
- $this->output->writeln(sprintf('Last login : %s', $user->getLastLogin() !== null ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'));
- $this->output->writeln(sprintf('2FA activated: %s', $user->isTwoFactorAuthentication() ? 'yes' : 'no'));
+ $this->io->listing([
+ sprintf('Username : %s', $user->getUsername()),
+ sprintf('Email : %s', $user->getEmail()),
+ sprintf('Display name : %s', $user->getName()),
+ sprintf('Creation date : %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
+ sprintf('Last login : %s', $user->getLastLogin() !== null ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
+ sprintf('2FA activated: %s', $user->isTwoFactorAuthentication() ? 'yes' : 'no'),
+ ]);
}
/**
{
return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username);
}
-
- private function getDoctrine()
- {
- return $this->getContainer()->get('doctrine');
- }
}
// is it a timestamp?
if (filter_var($date, FILTER_VALIDATE_INT) !== false) {
- $date = '@' . $value;
+ $date = '@' . $date;
}
try {
- $entry->setPublishedAt(new \DateTime($date));
+ // is it already a DateTime?
+ // (it's inside the try/catch in case of fail to be parse time string)
+ if (!$date instanceof \DateTime) {
+ $date = new \DateTime($date);
+ }
+
+ $entry->setPublishedAt($date);
} catch (\Exception $e) {
$this->logger->warning('Error while defining date', ['e' => $e, 'url' => $entry->getUrl(), 'date' => $value]);
}
*/
abstract protected function getImportService();
- /**
- * Return the template used for the form.
- *
- * @return string
- */
- abstract protected function getImportTemplate();
+ /**
+ * Return the template used for the form.
+ *
+ * @return string
+ */
+ abstract protected function getImportTemplate();
}
public function testPostSameEntry()
{
+ $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
+ $entry = new Entry($em->getReference(User::class, 1));
+ $entry->setUrl('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');
+ $entry->setArchived(true);
+ $entry->addTag((new Tag())->setLabel('google'));
+ $entry->addTag((new Tag())->setLabel('apple'));
+ $em->persist($entry);
+ $em->flush();
+ $em->clear();
+
$this->client->request('POST', '/api/entries.json', [
'url' => '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',
'archive' => '1',
$this->assertSame(400, $this->client->getResponse()->getStatusCode());
$this->assertContains('API limit reached', $this->client->getResponse()->getContent());
}
+
+ public function testRePostEntryAndReUsePublishedAt()
+ {
+ $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
+ $entry = new Entry($em->getReference(User::class, 1));
+ $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »');
+ $entry->setContent('hihi');
+ $entry->setUrl('http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html');
+ $entry->setPublishedAt(new \DateTime('2017-06-26T07:46:02+0200'));
+ $em->persist($entry);
+ $em->flush();
+ $em->clear();
+
+ $this->client->request('POST', '/api/entries.json', [
+ 'url' => 'http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html',
+ ]);
+
+ $this->assertSame(200, $this->client->getResponse()->getStatusCode());
+
+ $content = json_decode($this->client->getResponse()->getContent(), true);
+
+ $this->assertGreaterThan(0, $content['id']);
+ $this->assertSame('http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', $content['url']);
+ }
}
null,
],
'es-ES' => [
- 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google',
+ 'http://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google/',
'es_ES',
],
];