Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/Asset/AssetPathResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AssetPathResolver implements AssetPathResolverInterface

private ?LoggerInterface $logger;

public function __construct(array $designPaths, $webRootDir, LoggerInterface $logger = null)
public function __construct(array $designPaths, string $webRootDir, LoggerInterface $logger = null)
{
$this->designPaths = $designPaths;
$this->webRootDir = $webRootDir;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Asset/ProvisionedPathResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ProvisionedPathResolver implements AssetPathResolverInterface, AssetPathPr

private string $webRootDir;

public function __construct(array $resolvedPaths, AssetPathResolverInterface $innerResolver, $webRootDir)
public function __construct(array $resolvedPaths, AssetPathResolverInterface $innerResolver, string $webRootDir)
{
$this->resolvedPaths = $resolvedPaths;
$this->innerResolver = $innerResolver;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Templating/TemplatePathRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TemplatePathRegistry implements TemplatePathRegistryInterface, Serializabl

private string $kernelRootDir;

public function __construct($kernelRootDir)
public function __construct(string $kernelRootDir)
{
$this->kernelRootDir = $kernelRootDir;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Templating/Twig/TwigThemeLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getNamespaces(): array
/**
* @param string|string[] $paths
*/
public function setPaths(string|array $paths, $namespace = FilesystemLoader::MAIN_NAMESPACE): void
public function setPaths(string|array $paths, string $namespace = FilesystemLoader::MAIN_NAMESPACE): void
{
$this->innerFilesystemLoader->setPaths($paths, $namespace);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/Asset/AssetPathResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class AssetPathResolverTest extends TestCase
{
public function testResolveAssetPathFail()
public function testResolveAssetPathFail(): void
{
$logger = $this->createMock(LoggerInterface::class);
$logger
Expand All @@ -30,15 +30,15 @@ public function testResolveAssetPathFail()
/**
* @covers \Ibexa\DesignEngine\Asset\AssetPathResolver::resolveAssetPath
*/
public function testResolveInvalidDesign()
public function testResolveInvalidDesign(): void
{
$resolver = new AssetPathResolver([], __DIR__);
$assetPath = 'images/foo.png';
$this->expectException(InvalidDesignException::class);
self::assertSame($assetPath, $resolver->resolveAssetPath($assetPath, 'foo'));
}

public function resolveAssetPathProvider()
public function resolveAssetPathProvider(): array
{
return [
[
Expand Down Expand Up @@ -107,7 +107,7 @@ public function resolveAssetPathProvider()
/**
* @dataProvider resolveAssetPathProvider
*/
public function testResolveAssetPath(array $designPaths, array $existingPaths, $path, $resolvedPath)
public function testResolveAssetPath(array $designPaths, array $existingPaths, string $path, string $resolvedPath): void
{
$webrootDir = vfsStream::setup('web');
foreach ($designPaths['foo'] as $designPath) {
Expand Down
9 changes: 5 additions & 4 deletions tests/lib/Asset/ProvisionedPathResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
use Ibexa\DesignEngine\Asset\AssetPathResolverInterface;
use Ibexa\DesignEngine\Asset\ProvisionedPathResolver;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class ProvisionedPathResolverTest extends TestCase
{
/**
* @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\DesignEngine\Asset\AssetPathResolverInterface
*/
private $innerResolver;
private MockObject $innerResolver;

/**
* @var \org\bovigo\vfs\vfsStreamDirectory
Expand All @@ -32,7 +33,7 @@ protected function setUp(): void
$this->webrootDir = vfsStream::setup('web');
}

public function testResolvePathNotProvisioned()
public function testResolvePathNotProvisioned(): void
{
$assetLogicalPath = 'images/some_image.jpg';
$design = 'foo';
Expand All @@ -51,7 +52,7 @@ public function testResolvePathNotProvisioned()
self::assertSame($expected, $resolver->resolveAssetPath($assetLogicalPath, $design));
}

public function testResolveProvisionedPath()
public function testResolveProvisionedPath(): void
{
$expected = 'some/path/images/some_image.jpg';
$assetLogicalPath = 'images/some_image.jpg';
Expand All @@ -64,7 +65,7 @@ public function testResolveProvisionedPath()
self::assertSame($expected, $resolver->resolveAssetPath($assetLogicalPath, $design));
}

public function testProvisionResolvedPaths()
public function testProvisionResolvedPaths(): void
{
$design = 'some_design';
$themesPaths = [
Expand Down
11 changes: 6 additions & 5 deletions tests/lib/Asset/ThemePackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
use Ibexa\DesignEngine\Asset\AssetPathResolverInterface;
use Ibexa\DesignEngine\Asset\ThemePackage;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Asset\PackageInterface;

Expand All @@ -18,17 +19,17 @@ class ThemePackageTest extends TestCase
/**
* @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\DesignEngine\Asset\AssetPathResolverInterface
*/
private $assetPathResolver;
private MockObject $assetPathResolver;

/**
* @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\Asset\PackageInterface
*/
private $innerPackage;
private MockObject $innerPackage;

/**
* @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface
*/
private $configResolver;
private MockObject $configResolver;

protected function setUp(): void
{
Expand All @@ -39,7 +40,7 @@ protected function setUp(): void
$this->configResolver = $this->createMock(ConfigResolverInterface::class);
}

public function testGetUrl()
public function testGetUrl(): void
{
$assetPath = 'images/foo.png';
$fullAssetPath = 'assets/' . $assetPath;
Expand All @@ -65,7 +66,7 @@ public function testGetUrl()
self::assertSame("/$fullAssetPath", $package->getUrl($assetPath));
}

public function testGetVersion()
public function testGetVersion(): void
{
$assetPath = 'images/foo.png';
$fullAssetPath = 'assets/' . $assetPath;
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/Templating/TemplatePathRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

class TemplatePathRegistryTest extends TestCase
{
private function getExpectedRelativePath($templateFullPath, $kernelRootDir)
private function getExpectedRelativePath(string $templateFullPath, string $kernelRootDir): string
{
return str_replace($kernelRootDir . '/', '', $templateFullPath);
}

public function testMapTemplatePath()
public function testMapTemplatePath(): void
{
$kernelRootDir = __DIR__;
$templateLogicalName = '@foo/bar.html.twig';
Expand All @@ -32,7 +32,7 @@ public function testMapTemplatePath()
);
}

public function testGetTemplatePath()
public function testGetTemplatePath(): void
{
$kernelRootDir = __DIR__;
$templateLogicalName = '@foo/bar.html.twig';
Expand All @@ -46,7 +46,7 @@ public function testGetTemplatePath()
);
}

public function testGetTemplatePathNotMapped()
public function testGetTemplatePathNotMapped(): void
{
$kernelRootDir = __DIR__;
$templateLogicalName = '@foo/bar.html.twig';
Expand Down
11 changes: 6 additions & 5 deletions tests/lib/Templating/ThemeTemplateNameResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
use Ibexa\DesignEngine\Templating\ThemeTemplateNameResolver;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class ThemeTemplateNameResolverTest extends TestCase
{
/**
* @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface
*/
private $configResolver;
private MockObject $configResolver;

protected function setUp(): void
{
Expand All @@ -25,7 +26,7 @@ protected function setUp(): void
$this->configResolver = $this->createMock(ConfigResolverInterface::class);
}

public function templateNameProvider()
public function templateNameProvider(): array
{
return [
[null, 'foo.html.twig', 'foo.html.twig'],
Expand All @@ -37,7 +38,7 @@ public function templateNameProvider()
/**
* @dataProvider templateNameProvider
*/
public function testResolveTemplateName($currentDesign, $templateName, $expectedTemplateName)
public function testResolveTemplateName(?string $currentDesign, string $templateName, string $expectedTemplateName): void
{
$this->configResolver
->method('getParameter')
Expand All @@ -47,7 +48,7 @@ public function testResolveTemplateName($currentDesign, $templateName, $expected
self::assertSame($expectedTemplateName, $resolver->resolveTemplateName($templateName));
}

public function isTemplateDesignNamespacedProvider()
public function isTemplateDesignNamespacedProvider(): array
{
return [
[null, 'foo.html.twig', false],
Expand All @@ -60,7 +61,7 @@ public function isTemplateDesignNamespacedProvider()
/**
* @dataProvider isTemplateDesignNamespacedProvider
*/
public function testIsTemplateDesignNamespaced($currentDesign, $templateName, $expected)
public function testIsTemplateDesignNamespaced(?string $currentDesign, string $templateName, bool $expected): void
{
$this->configResolver
->method('getParameter')
Expand Down
Loading