Fixing tests

This commit is contained in:
Jeremy Benoist
2016-10-30 11:27:09 +01:00
parent 7f55941856
commit 48656e0eaa
7 changed files with 63 additions and 23 deletions

View File

@ -1,6 +1,6 @@
<?php
namespace Tests\Wallabag\CoreBundle\EventListener;
namespace Tests\Wallabag\CoreBundle\Event\Listener;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
@ -9,7 +9,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Wallabag\CoreBundle\EventListener\LocaleListener;
use Wallabag\CoreBundle\Event\Listener\LocaleListener;
class LocaleListenerTest extends \PHPUnit_Framework_TestCase
{

View File

@ -1,6 +1,6 @@
<?php
namespace Tests\Wallabag\CoreBundle\EventListener;
namespace Tests\Wallabag\CoreBundle\Event\Listener;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\EventListener\UserLocaleListener;
use Wallabag\CoreBundle\Event\Listener\UserLocaleListener;
use Wallabag\UserBundle\Entity\User;
class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase

View File

@ -1,11 +1,11 @@
<?php
namespace Tests\Wallabag\CoreBundle\Subscriber;
namespace Tests\Wallabag\CoreBundle\Event\Subscriber;
use Doctrine\Common\EventManager;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Mapping\ClassMetadata;
use Wallabag\CoreBundle\Subscriber\TablePrefixSubscriber;
use Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber;
class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase
{

View File

@ -83,6 +83,25 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase
$this->assertContains('/assets/images/4/2/4258f71e/ebe60399.'.$extension, $res);
}
public function testProcessSingleImageWithBadUrl()
{
$client = new Client();
$mock = new Mock([
new Response(404, []),
]);
$client->getEmitter()->attach($mock);
$logHandler = new TestHandler();
$logger = new Logger('test', array($logHandler));
$download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', $logger);
$res = $download->processSingleImage('T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY');
$this->assertFalse($res, 'Image can not be found, so it will not be replaced');
}
public function testProcessSingleImageWithBadImage()
{
$client = new Client();