$this->assertEquals(1, $crawler->filter('input[type=file]')->count());
}
+ public function testImportWallabagWithRabbitEnabled()
+ {
+ $this->logInAs('admin');
+ $client = $this->getClient();
+
+ $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 1);
+
+ $crawler = $client->request('GET', '/import/wallabag-v2');
+
+ $this->assertEquals(200, $client->getResponse()->getStatusCode());
+ $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
+ $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
+
+ $client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
+ }
+
+ public function testImportWallabagWithRedisEnabled()
+ {
+ $this->logInAs('admin');
+ $client = $this->getClient();
+
+ $client->getContainer()->get('craue_config')->set('import_with_redis', 1);
+
+ $crawler = $client->request('GET', '/import/wallabag-v2');
+
+ $this->assertEquals(200, $client->getResponse()->getStatusCode());
+ $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
+ $this->assertEquals(1, $crawler->filter('input[type=file]')->count());
+
+ $client->getContainer()->get('craue_config')->set('import_with_redis', 0);
+ }
+
+ public function testImportWallabagBadFile()
+ {
+ $this->logInAs('admin');
+ $client = $this->getClient();
+
+ $crawler = $client->request('GET', '/import/wallabag-v2');
+ $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
+
+ $data = [
+ 'upload_import_file[file]' => '',
+ ];
+
+ $client->submit($form, $data);
+
+ $this->assertEquals(200, $client->getResponse()->getStatusCode());
+ }
+
public function testImportWallabagWithFile()
{
$this->logInAs('admin');
$this->assertNotEmpty($content->getPreviewPicture());
$this->assertNotEmpty($content->getLanguage());
$this->assertEquals(2, count($content->getTags()));
+ $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
+ $this->assertEquals('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
}
public function testImportWallabagWithEmptyFile()