Skip to content

Commit

Permalink
Fix typo + fix tests + update dev dependencies. (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Jan 5, 2021
1 parent 7235077 commit 02c09e4
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 32 deletions.
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -27,11 +27,11 @@
},
"require-dev": {
"foxy/foxy": "^1.1",
"phpunit/phpunit": "^9.4",
"roave/infection-static-analysis-plugin": "^1.5",
"phpunit/phpunit": "^9.5",
"roave/infection-static-analysis-plugin": "^1.7",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.3",
"yiisoft/di": "3.0.x-dev"
"yiisoft/di": "^3.0@dev"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion config/params.php
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

return [
'yiisoft/asset' => [
'yiisoft/assets' => [
'assetConverter' => [
'command' => [
'from' => 'scss',
Expand Down
24 changes: 12 additions & 12 deletions config/web.php
Expand Up @@ -15,28 +15,28 @@
AssetConverterInterface::class => [
'__class' => AssetConverter::class,
'setCommand()' => [
$params['yiisoft/asset']['assetConverter']['command']['from'],
$params['yiisoft/asset']['assetConverter']['command']['to'],
$params['yiisoft/asset']['assetConverter']['command']['command'],
$params['yiisoft/assets']['assetConverter']['command']['from'],
$params['yiisoft/assets']['assetConverter']['command']['to'],
$params['yiisoft/assets']['assetConverter']['command']['command'],
],
'setForceConvert()' => [$params['yiisoft/asset']['assetConverter']['forceConvert']],
'setForceConvert()' => [$params['yiisoft/assets']['assetConverter']['forceConvert']],
],

AssetPublisherInterface::class => [
'__class' => AssetPublisher::class,
'setAppendTimestamp()' => [$params['yiisoft/asset']['assetPublisher']['appendTimestamp']],
'setAssetMap()' => [$params['yiisoft/asset']['assetPublisher']['assetMap']],
'setBasePath()' => [$params['yiisoft/asset']['assetPublisher']['basePath']],
'setBaseUrl()' => [$params['yiisoft/asset']['assetPublisher']['baseUrl']],
'setForceCopy()' => [$params['yiisoft/asset']['assetPublisher']['forceCopy']],
'setLinkAssets()' => [$params['yiisoft/asset']['assetPublisher']['linkAssets']],
'setAppendTimestamp()' => [$params['yiisoft/assets']['assetPublisher']['appendTimestamp']],
'setAssetMap()' => [$params['yiisoft/assets']['assetPublisher']['assetMap']],
'setBasePath()' => [$params['yiisoft/assets']['assetPublisher']['basePath']],
'setBaseUrl()' => [$params['yiisoft/assets']['assetPublisher']['baseUrl']],
'setForceCopy()' => [$params['yiisoft/assets']['assetPublisher']['forceCopy']],
'setLinkAssets()' => [$params['yiisoft/assets']['assetPublisher']['linkAssets']],
],

AssetManager::class => [
'__class' => AssetManager::class,
'setConverter()' => [Reference::to(AssetConverterInterface::class)],
'setPublisher()' => [Reference::to(AssetPublisherInterface::class)],
'setBundles()' => [$params['yiisoft/asset']['assetManager']['bundles']],
'register()' => [$params['yiisoft/asset']['assetManager']['register']],
'setBundles()' => [$params['yiisoft/assets']['assetManager']['bundles']],
'register()' => [$params['yiisoft/assets']['assetManager']['register']],
],
];
2 changes: 1 addition & 1 deletion docs/asset-converter.md
Expand Up @@ -83,7 +83,7 @@ AssetConverterInterface::class => static function (\Psr\Container\ContainerInter
or, if done via params.php:

```php
'yiisoft/asset' => [
'yiisoft/assets' => [
'assetConverter' => [
'command' => [
'from' => 'scss',
Expand Down
2 changes: 1 addition & 1 deletion src/AssetPublisher.php
Expand Up @@ -187,7 +187,7 @@ public function getAssetUrl(AssetBundle $bundle, string $assetPath): string
}

if (!is_file("$this->basePath/$assetPath")) {
throw new InvalidConfigException("Asset files not found: '$this->basePath/$assetPath.'");
throw new InvalidConfigException("Asset files not found: '$this->basePath/$assetPath'.");
}

if ($this->appendTimestamp && ($timestamp = FileHelper::lastModifiedTime("$this->basePath/$assetPath")) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion tests/AssetBundleTest.php
Expand Up @@ -162,7 +162,7 @@ public function testBasePathWrongException(): void
$this->assertEmpty($this->assetManager->getAssetBundles());

$file = $bundle->js[0];
$message = "Asset files not found: '$bundle->basePath/$file.'";
$message = "Asset files not found: '$bundle->basePath/$file'.";

$this->expectException(InvalidConfigException::class);
$this->expectExceptionMessage($message);
Expand Down
3 changes: 2 additions & 1 deletion tests/AssetPublisherTest.php
Expand Up @@ -401,7 +401,8 @@ private function verifySourcesPublishedBySymlink(): SourceAsset
$this->assertFileEquals($publishedFile, $sourceFile);
}

$this->assertTrue(FileHelper::unlink($bundle->basePath));
FileHelper::unlink($bundle->basePath);
$this->assertDirectoryDoesNotExist($bundle->basePath);

return $bundle;
}
Expand Down
24 changes: 12 additions & 12 deletions tests/TestCase.php
Expand Up @@ -159,29 +159,29 @@ private function config(): array
AssetConverterInterface::class => [
'__class' => AssetConverter::class,
'setCommand()' => [
$params['yiisoft/asset']['assetConverter']['command']['from'],
$params['yiisoft/asset']['assetConverter']['command']['to'],
$params['yiisoft/asset']['assetConverter']['command']['command'],
$params['yiisoft/assets']['assetConverter']['command']['from'],
$params['yiisoft/assets']['assetConverter']['command']['to'],
$params['yiisoft/assets']['assetConverter']['command']['command'],
],
'setForceConvert()' => [$params['yiisoft/asset']['assetConverter']['forceConvert']],
'setForceConvert()' => [$params['yiisoft/assets']['assetConverter']['forceConvert']],
],

AssetPublisherInterface::class => [
'__class' => AssetPublisher::class,
'setAppendTimestamp()' => [$params['yiisoft/asset']['assetPublisher']['appendTimestamp']],
'setAssetMap()' => [$params['yiisoft/asset']['assetPublisher']['assetMap']],
'setBasePath()' => [$params['yiisoft/asset']['assetPublisher']['basePath']],
'setBaseUrl()' => [$params['yiisoft/asset']['assetPublisher']['baseUrl']],
'setForceCopy()' => [$params['yiisoft/asset']['assetPublisher']['forceCopy']],
'setLinkAssets()' => [$params['yiisoft/asset']['assetPublisher']['linkAssets']],
'setAppendTimestamp()' => [$params['yiisoft/assets']['assetPublisher']['appendTimestamp']],
'setAssetMap()' => [$params['yiisoft/assets']['assetPublisher']['assetMap']],
'setBasePath()' => [$params['yiisoft/assets']['assetPublisher']['basePath']],
'setBaseUrl()' => [$params['yiisoft/assets']['assetPublisher']['baseUrl']],
'setForceCopy()' => [$params['yiisoft/assets']['assetPublisher']['forceCopy']],
'setLinkAssets()' => [$params['yiisoft/assets']['assetPublisher']['linkAssets']],
],

AssetManager::class => [
'__class' => AssetManager::class,
'setConverter()' => [Reference::to(AssetConverterInterface::class)],
'setPublisher()' => [Reference::to(AssetPublisherInterface::class)],
'setBundles()' => [$params['yiisoft/asset']['assetManager']['bundles']],
'register()' => [$params['yiisoft/asset']['assetManager']['register']],
'setBundles()' => [$params['yiisoft/assets']['assetManager']['bundles']],
'register()' => [$params['yiisoft/assets']['assetManager']['register']],
],
];
}
Expand Down

0 comments on commit 02c09e4

Please sign in to comment.