Преглед изворни кода

Fixed config file being deleted by mistake by build script

Alejandro Celaya пре 5 година
родитељ
комит
d289c62532

+ 2 - 2
.phpstorm.meta.php

@@ -2,7 +2,7 @@
 namespace PHPSTORM_META;
 
 use Psr\Container\ContainerInterface;
-use Zend\ServiceManager\ServiceManager;
+use Zend\ServiceManager\ServiceLocatorInterface;
 
 /**
  * PhpStorm Container Interop code completion
@@ -17,7 +17,7 @@ $STATIC_METHOD_TYPES = [
     ContainerInterface::get('') => [
         '' == '@',
     ],
-    ServiceManager::build('') => [
+    ServiceLocatorInterface::build('') => [
         '' == '@',
     ],
 ];

+ 2 - 1
composer.json

@@ -105,7 +105,8 @@
 
         "test": [
             "@test:unit",
-            "@test:db"
+            "@test:db",
+            "@test:api"
         ],
         "test:ci": [
             "@test:unit:ci",

+ 2 - 2
config/autoload/url-shortener.global.php

@@ -1,7 +1,7 @@
 <?php
 declare(strict_types=1);
 
-use Shlinkio\Shlink\Core\Service\UrlShortener;
+use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
 use function Shlinkio\Shlink\Common\env;
 
 return [
@@ -11,7 +11,7 @@ return [
             'schema' => env('SHORTENED_URL_SCHEMA', 'http'),
             'hostname' => env('SHORTENED_URL_HOSTNAME'),
         ],
-        'shortcode_chars' => env('SHORTCODE_CHARS', UrlShortener::DEFAULT_CHARS),
+        'shortcode_chars' => env('SHORTCODE_CHARS', UrlShortenerOptions::DEFAULT_CHARS),
         'validate_url' => true,
         'not_found_short_url' => [
             'enable_redirection' => false,

+ 2 - 2
config/autoload/phpwkhtmltopdf.global.php → config/autoload/wkhtmltopdf.global.php

@@ -3,9 +3,9 @@ declare(strict_types=1);
 
 return [
 
-    'phpwkhtmltopdf' => [
+    'wkhtmltopdf' => [
         'images' => [
-            'binary' => 'bin/wkhtmltoimage',
+            'binary' => __DIR__ . '/../../bin/wkhtmltoimage',
             'type' => 'jpg',
         ],
     ],

+ 1 - 1
module/Common/src/Exception/PreviewGenerationException.php

@@ -7,7 +7,7 @@ use function sprintf;
 
 class PreviewGenerationException extends RuntimeException
 {
-    public static function fromImageError($error)
+    public static function fromImageError(string $error): self
     {
         return new self(sprintf('Error generating a preview image with error: %s', $error));
     }

+ 1 - 1
module/Common/src/Image/ImageFactory.php

@@ -26,7 +26,7 @@ class ImageFactory implements FactoryInterface
      */
     public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
     {
-        $config = $container->get('config')['phpwkhtmltopdf'];
+        $config = $container->get('config')['wkhtmltopdf'];
         $image = new Image($config['images'] ?? null);
 
         if ($options['url'] ?? null) {

+ 1 - 2
module/Common/src/Service/PreviewGenerator.php

@@ -19,7 +19,7 @@ class PreviewGenerator implements PreviewGeneratorInterface
     /** @var Filesystem */
     private $filesystem;
 
-    public function __construct(ImageBuilderInterface $imageBuilder, Filesystem $filesystem, $location)
+    public function __construct(ImageBuilderInterface $imageBuilder, Filesystem $filesystem, string $location)
     {
         $this->location = $location;
         $this->imageBuilder = $imageBuilder;
@@ -33,7 +33,6 @@ class PreviewGenerator implements PreviewGeneratorInterface
      */
     public function generatePreview(string $url): string
     {
-        /** @var Image $image */
         $image = $this->imageBuilder->build(Image::class, ['url' => $url]);
 
         // If the file already exists, return its path

+ 2 - 2
module/Common/test/Image/ImageFactoryTest.php

@@ -26,7 +26,7 @@ class ImageFactoryTest extends TestCase
     {
         /** @var Image $image */
         $image = $this->factory->__invoke(new ServiceManager(['services' => [
-            'config' => ['phpwkhtmltopdf' => []],
+            'config' => ['wkhtmltopdf' => []],
         ]]), '');
         $this->assertInstanceOf(Image::class, $image);
 
@@ -45,7 +45,7 @@ class ImageFactoryTest extends TestCase
 
         /** @var Image $image */
         $image = $this->factory->__invoke(new ServiceManager(['services' => [
-            'config' => ['phpwkhtmltopdf' => []],
+            'config' => ['wkhtmltopdf' => []],
         ]]), '', ['url' => $expectedPage]);
         $this->assertInstanceOf(Image::class, $image);