Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.x #371

Merged
merged 5 commits into from
Sep 29, 2023
Merged

5.x #371

Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
phpunit.xml.dist export-ignore
psalm.xml export-ignore
psalm-baseline.xml export-ignore
.travis.yml export-ignore
phpstan.neon
phpcs.xml
.stickler.yml export-ignore
.github export-ignore
.phive export-ignore
.editorconfig export-ignore
tests/ export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/composer.lock
/.idea
.phpunit.result.cache
.phpunit.cache
5 changes: 5 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.10.35" installed="1.10.35" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.15.0" installed="5.15.0" location="./tools/psalm" copy="false"/>
</phive>
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
},
"require": {
"php": ">=8.1.0",
"cakephp/cakephp": "5.x-dev",
"cakephp/cakephp": "^5.0",
"markstory/mini-asset": "2.x-dev",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to take care of this 🙂

"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "5.x-dev",
"cakephp/cakephp-codesniffer": "^5.0",
"phpunit/phpunit": "^10.1.0"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected function clearPath(ConsoleIo $io, string $path, array $themes, array $
// themed files
foreach ($themes as $theme) {
if (strpos($base, $theme) === 0 && strpos($base, '-') !== false) {
[$themePrefix, $base] = explode('-', $base);
[, $base] = explode('-', $base);
}
}
if (in_array($base, $targets)) {
Expand Down
6 changes: 3 additions & 3 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class Factory extends BaseFactory
/**
* Create an AssetWriter
*
* @param string $path The path to use
* @param string $tmpPath The path to use
* @return \MiniAsset\Output\AssetWriter
*/
public function writer(string $path = TMP): AssetWriter
public function writer(string $tmpPath = TMP): AssetWriter
{
return parent::writer($this->config->get('general.timestampPath') ?: $path);
return parent::writer($this->config->get('general.timestampPath') ?: $tmpPath);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/TestCase/View/Helper/AssetCompressHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,25 @@ public function testAttributesOnElements()
*/
public function testAssetsToBlock()
{
$result = $this->Helper->script('libs.js', ['block' => 'custom']);
$result = $this->Helper->script('libs.js', ['block' => 'custom', 'defer' => true]);
$this->assertNull($result);

$result = $this->Helper->css('all.css', ['block' => 'custom']);
$result = $this->Helper->css('all.css', ['block' => 'custom', 'test' => 'value']);
$this->assertNull($result);

$expected = [
['script' => [
'defer' => 'defer',
'src' => '/cache_js/libs.js',
]],
'/script',
['link' => [
'test' => 'value',
'rel' => 'stylesheet',
'href' => '/cache_css/all.css',
]],
];
$result = $this->View->getBlock('custom');
$result = $this->View->fetch('custom');
$this->assertHtml($expected, $result);
}

Expand Down