aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>2015-10-06 20:51:40 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@smile.fr>2015-10-06 20:51:40 +0200
commitce782c84b85f23c6c6a47cd044694f48377e8416 (patch)
tree3d861d163d7b799a9d1b39703db5c3b278dbab39
parent3123b3c0c8d6a67d85973e5b17a5952b6931c54d (diff)
downloadwallabag-ce782c84b85f23c6c6a47cd044694f48377e8416.tar.gz
wallabag-ce782c84b85f23c6c6a47cd044694f48377e8416.tar.zst
wallabag-ce782c84b85f23c6c6a47cd044694f48377e8416.zip
fix bug on detect active theme
-rw-r--r--src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php8
-rw-r--r--src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
index 679186c0..054a3752 100644
--- a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
+++ b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
@@ -42,7 +42,13 @@ class DetectActiveTheme implements DeviceDetectionInterface
42 */ 42 */
43 public function getType() 43 public function getType()
44 { 44 {
45 $user = $this->securityContext->getToken()->getUser(); 45 $token = $this->securityContext->getToken();
46
47 if (is_null($token)) {
48 return $this->defaultTheme;
49 }
50
51 $user = $token->getUser();
46 52
47 if (!$user instanceof User) { 53 if (!$user instanceof User) {
48 return $this->defaultTheme; 54 return $this->defaultTheme;
diff --git a/src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php b/src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php
index 4945e9a9..9af8fad8 100644
--- a/src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Twig/WallabagExtensionTest.php
@@ -10,8 +10,8 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
10 { 10 {
11 $extension = new WallabagExtension(); 11 $extension = new WallabagExtension();
12 12
13 $this->assertEquals("lemonde.fr", $extension->removeWww('www.lemonde.fr')); 13 $this->assertEquals('lemonde.fr', $extension->removeWww('www.lemonde.fr'));
14 $this->assertEquals("lemonde.fr", $extension->removeWww('lemonde.fr')); 14 $this->assertEquals('lemonde.fr', $extension->removeWww('lemonde.fr'));
15 $this->assertEquals("gist.github.com", $extension->removeWww('gist.github.com')); 15 $this->assertEquals('gist.github.com', $extension->removeWww('gist.github.com'));
16 } 16 }
17} 17}