4 Commits

Author SHA1 Message Date
  raphael 7d82013274 Merge branch 'hotfix' of https://git.logipro.com/raphael/Phoenix into hotfix 3 years ago
  raphael b59a9d592c TLD-543 @fixed tests + patch 3 years ago
  raphael e1d02dfadb TLD-543 @fixed tests + patch 3 years ago
  raphael f59a8de6e8 BGC-202 @fixed 3 years ago

+ 2
- 4
config/packages/liip_imagine.yaml View File

@@ -13,9 +13,7 @@ liip_imagine:
13 13
 
14 14
         # the name of the "filter set"
15 15
         my_thumb:
16
-
17
-            # adjust the image quality to 75%
18 16
             quality: 75
19
-
20 17
             filters:
21
-                relative_resize: { widen: 300 }
18
+                downscale:
19
+                    max: [300, 300]

+ 38
- 0
src/Phoenix/Command/ClearThumbCommand.php View File

@@ -0,0 +1,38 @@
1
+<?php
2
+
3
+namespace Logipro\Phoenix\Command;
4
+
5
+use Symfony\Component\Console\Command\Command;
6
+use Liip\ImagineBundle\Imagine\Cache\CacheManager;
7
+use Symfony\Component\Console\Input\InputInterface;
8
+use Symfony\Component\Console\Output\OutputInterface;
9
+
10
+class ClearThumbCommand extends Command
11
+{
12
+	private $uploader;
13
+	private $entityManager;
14
+	private $cacheManager;
15
+
16
+	public function __construct(CacheManager $cacheManager)
17
+	{
18
+		parent::__construct();
19
+
20
+		$this->cacheManager = $cacheManager;
21
+	}
22
+	/**
23
+	 *
24
+	 * {@inheritDoc}
25
+	 * @see \Symfony\Component\Console\Command\Command::configure()
26
+	 */
27
+	protected function configure()
28
+	{
29
+		$this->setName('phoenix:thumb:clear');
30
+		$this->setDescription("Supprime les miniatures des images");
31
+		$this->setHelp("");
32
+	}
33
+
34
+	protected function execute(InputInterface $input, OutputInterface $output)
35
+	{
36
+		$this->cacheManager->remove();
37
+	}
38
+}

+ 40
- 0
src/Phoenix/DoctrineMigrations/Version20191209165250.php View File

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+namespace Logipro\Phoenix\DoctrineMigrations;
4
+
5
+use Doctrine\DBAL\Schema\Schema;
6
+use Doctrine\Migrations\AbstractMigration;
7
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8
+use Symfony\Component\DependencyInjection\ContainerInterface;
9
+use Symfony\Component\Console\Input\ArrayInput;
10
+use Symfony\Component\Console\Output\BufferedOutput;
11
+use Symfony\Bundle\FrameworkBundle\Console\Application;
12
+
13
+final class Version20191209165250 extends AbstractMigration
14
+implements ContainerAwareInterface
15
+{
16
+    private $kernel;
17
+
18
+    public function setContainer(ContainerInterface $container = null)
19
+    {
20
+        $this->kernel = $container->get('kernel');
21
+    }
22
+
23
+    public function up(Schema $schema): void
24
+    {
25
+        $application = new Application($this->kernel);
26
+        $application->setAutoExit(false);
27
+
28
+        $input = new ArrayInput([
29
+            'command' => 'phoenix:thumb:clear'
30
+        ]);
31
+
32
+        $output = new BufferedOutput();
33
+        $application->run($input, $output);
34
+
35
+        $this->write($output->fetch());
36
+    }
37
+
38
+    public function down(Schema $schema): void
39
+    { }
40
+}

+ 4
- 1
src/Phoenix/Twig/UploaderExtension.php View File

@@ -25,6 +25,8 @@ class UploaderExtension extends \Twig_Extension
25 25
      */
26 26
     private $helper;
27 27
 
28
+    private $cacheManager;
29
+
28 30
     public function __construct(UploaderHelper $helper,CacheManager $cacheManager,ContainerInterface $container)
29 31
     {
30 32
         $this->helper = $helper;
@@ -74,7 +76,8 @@ class UploaderExtension extends \Twig_Extension
74 76
         }
75 77
         
76 78
         // supprime le début du chemin car le gestionnaire de cache l'ajoute de lui même
77
-        $assetObject = str_replace($uploadStartPath,'',$assetObject);
79
+        $assetObject = trim(str_replace($uploadStartPath,'',$assetObject),'/');
80
+
78 81
 
79 82
         $url = $this->cacheManager->getBrowserPath($assetObject,$thumb);
80 83
         return $url;

+ 1
- 1
templates/learning_space/pages/login/login.html.twig View File

@@ -31,7 +31,7 @@
31 31
 						
32 32
 							<div class="ali-ls-card col-xl-3 col-lg-4 col-md-8 col-sm-10 offset-lg-1">
33 33
 								<div class="ali-ls-card-image">
34
-									{% set logoClient = vich_uploader_asset(site_logo_path,'valueFile') %}
34
+									{% set logoClient = phx_uploader_asset(site_logo_path,'valueFile') %}
35 35
 									{% if logoClient %}
36 36
 										<img class="logo" alt="logo-client" src="{{ logoClient }}"/>
37 37
 									{% else %}

+ 44
- 0
tests/Phoenix/Controller/LearningSpace/LoginControllerTest.php View File

@@ -55,6 +55,50 @@ class LoginControllerTest extends PhxWebTestCase
55 55
         $this->assertEquals(404, $client->getResponse()->getStatusCode());
56 56
     }
57 57
 
58
+    public function testManagerLoginStatusCode()
59
+    {
60
+        $client = static::createClient();
61
+
62
+        $parameters = array();
63
+        $client->request('GET', $this->getRoutePath('ls_login'), $parameters);
64
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
65
+    }
66
+
67
+    public function testManagerLoginImageThumb()
68
+    {
69
+        $client = static::createClient();
70
+
71
+        $parameters = array();
72
+        $crawler = $client->request('GET', $this->getRoutePath('ls_login'), $parameters);
73
+
74
+        $link = $crawler->filter('img.logo')->first()->attr('src');
75
+
76
+        // test si l'url utilise une miniature
77
+        $this->assertContains('my_thumb', $link);
78
+    }
79
+
80
+    public function testManagerRecoverStatusCode()
81
+    {
82
+        $client = static::createClient();
83
+
84
+        $parameters = array();
85
+        $client->request('GET', $this->getRoutePath('ls_password_recover'), $parameters);
86
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
87
+    }
88
+
89
+    public function testManagerRecoverImageThumb()
90
+    {
91
+        $client = static::createClient();
92
+
93
+        $parameters = array();
94
+        $crawler = $client->request('GET', $this->getRoutePath('ls_password_recover'), $parameters);
95
+
96
+        $link = $crawler->filter('img.logo')->first()->attr('src');
97
+
98
+        // test si l'url utilise une miniature
99
+        $this->assertContains('my_thumb', $link);
100
+    }
101
+
58 102
 
59 103
     /**
60 104
      * sera développé quand on aura les fixtures de dev dans cette branche

Loading…
Cancel
Save