diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-30 11:27:09 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-30 11:27:09 +0100 |
commit | 48656e0eaac006a80f21e9aec8900747fe76283a (patch) | |
tree | 8b685bd1b2b68b47a12b2bc17f076683c466603f /tests | |
parent | 7f55941856549a3f5f45c42fdc171d66ff7ee297 (diff) | |
download | wallabag-48656e0eaac006a80f21e9aec8900747fe76283a.tar.gz wallabag-48656e0eaac006a80f21e9aec8900747fe76283a.tar.zst wallabag-48656e0eaac006a80f21e9aec8900747fe76283a.zip |
Fixing tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php (renamed from tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php) | 4 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php (renamed from tests/Wallabag/CoreBundle/EventListener/UserLocaleListenerTest.php) | 4 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php (renamed from tests/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriberTest.php) | 4 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php | 19 |
4 files changed, 25 insertions, 6 deletions
diff --git a/tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php index 078bb69a..84a54d3a 100644 --- a/tests/Wallabag/CoreBundle/EventListener/LocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php | |||
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\EventListener; | 3 | namespace Tests\Wallabag\CoreBundle\Event\Listener; |
4 | 4 | ||
5 | use Symfony\Component\EventDispatcher\EventDispatcher; | 5 | use Symfony\Component\EventDispatcher\EventDispatcher; |
6 | use Symfony\Component\HttpFoundation\Request; | 6 | use Symfony\Component\HttpFoundation\Request; |
@@ -9,7 +9,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; | |||
9 | use Symfony\Component\HttpKernel\Event\GetResponseEvent; | 9 | use Symfony\Component\HttpKernel\Event\GetResponseEvent; |
10 | use Symfony\Component\HttpKernel\HttpKernelInterface; | 10 | use Symfony\Component\HttpKernel\HttpKernelInterface; |
11 | use Symfony\Component\HttpKernel\KernelEvents; | 11 | use Symfony\Component\HttpKernel\KernelEvents; |
12 | use Wallabag\CoreBundle\EventListener\LocaleListener; | 12 | use Wallabag\CoreBundle\Event\Listener\LocaleListener; |
13 | 13 | ||
14 | class LocaleListenerTest extends \PHPUnit_Framework_TestCase | 14 | class LocaleListenerTest extends \PHPUnit_Framework_TestCase |
15 | { | 15 | { |
diff --git a/tests/Wallabag/CoreBundle/EventListener/UserLocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php index e9ac7c1d..45aecc63 100644 --- a/tests/Wallabag/CoreBundle/EventListener/UserLocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php | |||
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\EventListener; | 3 | namespace Tests\Wallabag\CoreBundle\Event\Listener; |
4 | 4 | ||
5 | use Symfony\Component\HttpFoundation\Request; | 5 | use Symfony\Component\HttpFoundation\Request; |
6 | use Symfony\Component\HttpFoundation\Session\Session; | 6 | use Symfony\Component\HttpFoundation\Session\Session; |
@@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; | |||
8 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; | 8 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; |
9 | use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; | 9 | use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; |
10 | use Wallabag\CoreBundle\Entity\Config; | 10 | use Wallabag\CoreBundle\Entity\Config; |
11 | use Wallabag\CoreBundle\EventListener\UserLocaleListener; | 11 | use Wallabag\CoreBundle\Event\Listener\UserLocaleListener; |
12 | use Wallabag\UserBundle\Entity\User; | 12 | use Wallabag\UserBundle\Entity\User; |
13 | 13 | ||
14 | class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase | 14 | class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase |
diff --git a/tests/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriberTest.php b/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php index 4ae76703..b8cd0fad 100644 --- a/tests/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriberTest.php +++ b/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php | |||
@@ -1,11 +1,11 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\Subscriber; | 3 | namespace Tests\Wallabag\CoreBundle\Event\Subscriber; |
4 | 4 | ||
5 | use Doctrine\Common\EventManager; | 5 | use Doctrine\Common\EventManager; |
6 | use Doctrine\ORM\Event\LoadClassMetadataEventArgs; | 6 | use Doctrine\ORM\Event\LoadClassMetadataEventArgs; |
7 | use Doctrine\ORM\Mapping\ClassMetadata; | 7 | use Doctrine\ORM\Mapping\ClassMetadata; |
8 | use Wallabag\CoreBundle\Subscriber\TablePrefixSubscriber; | 8 | use Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber; |
9 | 9 | ||
10 | class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase | 10 | class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase |
11 | { | 11 | { |
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php index 0273693e..e000d681 100644 --- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php +++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php | |||
@@ -83,6 +83,25 @@ class DownloadImagesTest extends \PHPUnit_Framework_TestCase | |||
83 | $this->assertContains('/assets/images/4/2/4258f71e/ebe60399.'.$extension, $res); | 83 | $this->assertContains('/assets/images/4/2/4258f71e/ebe60399.'.$extension, $res); |
84 | } | 84 | } |
85 | 85 | ||
86 | public function testProcessSingleImageWithBadUrl() | ||
87 | { | ||
88 | $client = new Client(); | ||
89 | |||
90 | $mock = new Mock([ | ||
91 | new Response(404, []), | ||
92 | ]); | ||
93 | |||
94 | $client->getEmitter()->attach($mock); | ||
95 | |||
96 | $logHandler = new TestHandler(); | ||
97 | $logger = new Logger('test', array($logHandler)); | ||
98 | |||
99 | $download = new DownloadImages($client, sys_get_temp_dir().'/wallabag_test', $logger); | ||
100 | $res = $download->processSingleImage('T9qgcHc.jpg', 'http://imgur.com/gallery/WxtWY'); | ||
101 | |||
102 | $this->assertFalse($res, 'Image can not be found, so it will not be replaced'); | ||
103 | } | ||
104 | |||
86 | public function testProcessSingleImageWithBadImage() | 105 | public function testProcessSingleImageWithBadImage() |
87 | { | 106 | { |
88 | $client = new Client(); | 107 | $client = new Client(); |