Skip to content

Commit 6dc6e13

Browse files
committed
fix tests
1 parent c2ef1f2 commit 6dc6e13

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"require-dev": {
2121
"friendsofphp/php-cs-fixer": "^3.8",
2222
"nunomaduro/collision": "^4.1|^5.0|^6.0|^8.1",
23-
"orchestra/testbench": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0",
23+
"orchestra/testbench": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
2424
"phpunit/phpunit": "^9.5|^10.0|^11.0"
2525
},
2626
"autoload": {

src/ServiceProvider.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ class ServiceProvider extends AddonServiceProvider
88
{
99
public function bootAddon()
1010
{
11+
/**
12+
* bootConfig() does not get called during unit tests,
13+
* so we manually merge the config here.
14+
*/
15+
if (app()->runningUnitTests()) {
16+
$this->mergeConfigFrom(
17+
__DIR__ . '/../config/statamic-clear-assets.php',
18+
'statamic-clear-assets'
19+
);
20+
}
21+
1122
$this->commands([
1223
ClearAssets::class,
1324
]);

tests/ClearAssetsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function it_can_list_unused_assets()
5656
*/
5757
public function it_ignores_containers()
5858
{
59+
// These two assets are in ignored containers by default
5960
$this->createAsset('ankara.jpg', 'social_images');
6061
$this->createAsset('tallinn.jpg', 'favicons');
6162

@@ -127,7 +128,7 @@ public function it_skips_confirmation_in_no_interaction_mode()
127128

128129
private function createAsset($filename, $container = 'assets')
129130
{
130-
$tmpFile = tempnam(sys_get_temp_dir(), 'test_' . $filename);
131+
$tmpFile = tempnam(sys_get_temp_dir(), $filename);
131132
copy(__DIR__ . '/fixtures/' . $filename, $tmpFile);
132133

133134
$file = new UploadedFile(

0 commit comments

Comments
 (0)