namespace Tests\Wallabag\ImportBundle\Controller;
-use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Symfony\Component\HttpFoundation\File\UploadedFile;
+use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class ChromeControllerTest extends WallabagCoreTestCase
{
$crawler = $client->request('GET', '/import/chrome');
- $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());
+ $this->assertSame(200, $client->getResponse()->getStatusCode());
+ $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
+ $this->assertSame(1, $crawler->filter('input[type=file]')->count());
}
public function testImportChromeWithRabbitEnabled()
$crawler = $client->request('GET', '/import/chrome');
- $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());
+ $this->assertSame(200, $client->getResponse()->getStatusCode());
+ $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
+ $this->assertSame(1, $crawler->filter('input[type=file]')->count());
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
}
$client->submit($form, $data);
- $this->assertEquals(200, $client->getResponse()->getStatusCode());
+ $this->assertSame(200, $client->getResponse()->getStatusCode());
}
public function testImportChromeWithRedisEnabled()
$crawler = $client->request('GET', '/import/chrome');
- $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());
+ $this->assertSame(200, $client->getResponse()->getStatusCode());
+ $this->assertSame(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count());
+ $this->assertSame(1, $crawler->filter('input[type=file]')->count());
$form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
- $file = new UploadedFile(__DIR__.'/../fixtures/chrome-bookmarks', 'Bookmarks');
+ $file = new UploadedFile(__DIR__ . '/../fixtures/chrome-bookmarks', 'Bookmarks');
$data = [
'upload_import_file[file]' => $file,
$client->submit($form, $data);
- $this->assertEquals(302, $client->getResponse()->getStatusCode());
+ $this->assertSame(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$crawler = $client->request('GET', '/import/chrome');
$form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
- $file = new UploadedFile(__DIR__.'/../fixtures/chrome-bookmarks', 'Bookmarks');
+ $file = new UploadedFile(__DIR__ . '/../fixtures/chrome-bookmarks', 'Bookmarks');
$data = [
'upload_import_file[file]' => $file,
$client->submit($form, $data);
- $this->assertEquals(302, $client->getResponse()->getStatusCode());
+ $this->assertSame(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry')
->findByUrlAndUserId(
- 'http://www.usinenouvelle.com/article/la-multiplication-des-chefs-de-projet-est-une-catastrophe-manageriale-majeure-affirme-le-sociologue-francois-dupuy.N307730',
+ 'https://www.usinenouvelle.com/article/la-multiplication-des-chefs-de-projet-est-une-catastrophe-manageriale-majeure-affirme-le-sociologue-francois-dupuy.N307730',
$this->getLoggedInUserId()
);
- $this->assertNotEmpty($content->getPreviewPicture());
- $this->assertNotEmpty($content->getLanguage());
- $this->assertEquals(0, count($content->getTags()));
+ $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->assertCount(1, $content->getTags());
$createdAt = $content->getCreatedAt();
- $this->assertEquals('2011', $createdAt->format('Y'));
- $this->assertEquals('07', $createdAt->format('m'));
+ $this->assertSame('2011', $createdAt->format('Y'));
+ $this->assertSame('07', $createdAt->format('m'));
}
public function testImportWallabagWithEmptyFile()
$crawler = $client->request('GET', '/import/chrome');
$form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form();
- $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt');
+ $file = new UploadedFile(__DIR__ . '/../fixtures/test.txt', 'test.txt');
$data = [
'upload_import_file[file]' => $file,
$client->submit($form, $data);
- $this->assertEquals(302, $client->getResponse()->getStatusCode());
+ $this->assertSame(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();