Browse Source

Update composer dependencies & Fix tests

Bubka 8 months ago
parent
commit
080becf80c
5 changed files with 193 additions and 181 deletions
  1. 1 0
      app/Services/IconStoreService.php
  2. 184 177
      composer.lock
  3. 3 2
      phpunit.xml
  4. 2 2
      tests/Data/OtpTestData.php
  5. 3 0
      tests/Feature/Services/IconServiceTest.php

+ 1 - 0
app/Services/IconStoreService.php

@@ -42,6 +42,7 @@ class IconStoreService
 
         $this->svgSanitizer = $svgSanitizer;
         $this->svgSanitizer->removeRemoteReferences(true);
+        $this->svgSanitizer->minify(true);
     }
 
     /**

File diff suppressed because it is too large
+ 184 - 177
composer.lock


+ 3 - 2
phpunit.xml

@@ -8,6 +8,7 @@
     displayDetailsOnTestsThatTriggerErrors="true"
     displayDetailsOnTestsThatTriggerNotices="true"
     displayDetailsOnTestsThatTriggerWarnings="true"
+    displayDetailsOnPhpunitDeprecations="true"
     processIsolation="false"
     stopOnFailure="false"
     stopOnError="false"
@@ -20,7 +21,7 @@
             <directory suffix=".php">app/Protobuf</directory>
         </exclude>
     </source>
-    <coverage includeUncoveredFiles="true">
+    <coverage>
     </coverage>
     <testsuites>
         <testsuite name="Unit">
@@ -34,7 +35,7 @@
         </testsuite>
     </testsuites>
     <php>
-        <ini name="memory_limit" value="2048M" />
+        <ini name="memory_limit" value="2048M"/>
         <env name="APP_ENV" value="testing"/>
         <!-- following values override .env.testing vars -->
     </php>

+ 2 - 2
tests/Data/OtpTestData.php

@@ -58,9 +58,9 @@ class OtpTestData
 
     const ICON_SVG = 'test.svg';
 
-    const ICON_SVG_DATA = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><circle cx="512" cy="512" r="512" style="fill:#000e9c"/><path d="m700.2 466.5 61.2-106.3c23.6 41.6 37.2 89.8 37.2 141.1 0 68.8-24.3 131.9-64.7 181.4H575.8l48.7-84.6h-64.4l75.8-131.7 64.3.1zm-55.4-125.2L448.3 682.5l.1.2H290.1c-40.5-49.5-64.7-112.6-64.7-181.4 0-51.4 13.6-99.6 37.3-141.3l102.5 178.2 113.3-197h166.3z" style="fill:#fff"/></svg>';
+    const ICON_SVG_DATA = '<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><circle cx="512" cy="512" r="512" style="fill:#000e9c"></circle><path d="m700.2 466.5 61.2-106.3c23.6 41.6 37.2 89.8 37.2 141.1 0 68.8-24.3 131.9-64.7 181.4H575.8l48.7-84.6h-64.4l75.8-131.7 64.3.1zm-55.4-125.2L448.3 682.5l.1.2H290.1c-40.5-49.5-64.7-112.6-64.7-181.4 0-51.4 13.6-99.6 37.3-141.3l102.5 178.2 113.3-197h166.3z" style="fill:#fff"></path></svg>';
 
-    const ICON_SVG_DATA_ENCODED = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPg0KICAgPGNpcmNsZSBjeD0iNTEyIiBjeT0iNTEyIiByPSI1MTIiIHN0eWxlPSJmaWxsOiMwMDBlOWMiLz4NCiAgIDxwYXRoIGQ9Im03MDAuMiA0NjYuNSA2MS4yLTEwNi4zYzIzLjYgNDEuNiAzNy4yIDg5LjggMzcuMiAxNDEuMSAwIDY4LjgtMjQuMyAxMzEuOS02NC43IDE4MS40SDU3NS44bDQ4LjctODQuNmgtNjQuNGw3NS44LTEzMS43IDY0LjMuMXptLTU1LjQtMTI1LjJMNDQ4LjMgNjgyLjVsLjEuMkgyOTAuMWMtNDAuNS00OS41LTY0LjctMTEyLjYtNjQuNy0xODEuNCAwLTUxLjQgMTMuNi05OS42IDM3LjMtMTQxLjNsMTAyLjUgMTc4LjIgMTEzLjMtMTk3aDE2Ni4zeiIgc3R5bGU9ImZpbGw6I2ZmZiIvPg0KPC9zdmc+DQo=';
+    const ICON_SVG_DATA_ENCODED = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4gPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxjaXJjbGUgY3g9IjUxMiIgY3k9IjUxMiIgcj0iNTEyIiBzdHlsZT0iZmlsbDojMDAwZTljIj48L2NpcmNsZT48cGF0aCBkPSJtNzAwLjIgNDY2LjUgNjEuMi0xMDYuM2MyMy42IDQxLjYgMzcuMiA4OS44IDM3LjIgMTQxLjEgMCA2OC44LTI0LjMgMTMxLjktNjQuNyAxODEuNEg1NzUuOGw0OC43LTg0LjZoLTY0LjRsNzUuOC0xMzEuNyA2NC4zLjF6bS01NS40LTEyNS4yTDQ0OC4zIDY4Mi41bC4xLjJIMjkwLjFjLTQwLjUtNDkuNS02NC43LTExMi42LTY0LjctMTgxLjQgMC01MS40IDEzLjYtOTkuNiAzNy4zLTE0MS4zbDEwMi41IDE3OC4yIDExMy4zLTE5N2gxNjYuM3oiIHN0eWxlPSJmaWxsOiNmZmYiPjwvcGF0aD48L3N2Zz4g';
 
     const ICON_SVG_MALICIOUS_CODE = '<script>alert("XSS");</script>';
 

+ 3 - 0
tests/Feature/Services/IconServiceTest.php

@@ -76,6 +76,9 @@ class IconServiceTest extends FeatureTestCase
     #[Test]
     public function test_buildFromResource_returns_null_when_store_fails()
     {
+        Storage::shouldReceive('disk->mimeType')
+            ->andReturn('image/png');
+
         Storage::shouldReceive('disk->put')
             ->andReturn(false);
 

Some files were not shown because too many files changed in this diff