File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Tatter \Assets ;
4
4
5
+ use CodeIgniter \Config \Factories ;
5
6
use CodeIgniter \Files \File ;
6
7
use Tatter \Assets \Config \Assets as AssetsConfig ;
7
8
use Tatter \Assets \Exceptions \AssetsException ;
@@ -76,6 +77,9 @@ public static function config(): AssetsConfig
76
77
public static function useConfig (?AssetsConfig $ config )
77
78
{
78
79
self ::$ config = $ config ;
80
+
81
+ // If a new config was supplied then use it with Factories, otherwise reset to the "vanilla" version
82
+ Factories::injectMock ('config ' , 'Assets ' , $ config ?? new AssetsConfig ());
79
83
}
80
84
81
85
//--------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ protected function setUpAssetsTestTrait(): void
45
45
}
46
46
47
47
// Create the config
48
- $ this ->config = config ( ' Assets ' );
48
+ $ this ->config = new AssetsConfig ( );
49
49
$ this ->config ->directory = $ this ->root ->url () . DIRECTORY_SEPARATOR ;
50
50
$ this ->config ->useTimestamps = false ; // These make testing much harder
51
51
@@ -64,6 +64,8 @@ protected function tearDownAssetsTestTrait(): void
64
64
$ this ->root = null ;
65
65
$ this ->published = false ;
66
66
}
67
+
68
+ Asset::useConfig (null );
67
69
}
68
70
69
71
/**
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public function testUsesConfig()
34
34
$ result = Asset::config ();
35
35
36
36
$ this ->assertSame ($ config , $ result );
37
- $ this ->assertNotSame (config (AssetsConfig::class), $ result );
37
+ $ this ->assertSame (config (AssetsConfig::class), $ result );
38
38
}
39
39
40
40
public function testLoadsConfig ()
You can’t perform that action at this time.
0 commit comments