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 22
33namespace Tatter \Assets ;
44
5+ use CodeIgniter \Config \Factories ;
56use CodeIgniter \Files \File ;
67use Tatter \Assets \Config \Assets as AssetsConfig ;
78use Tatter \Assets \Exceptions \AssetsException ;
@@ -76,6 +77,9 @@ public static function config(): AssetsConfig
7677 public static function useConfig (?AssetsConfig $ config )
7778 {
7879 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 ());
7983 }
8084
8185 //--------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ protected function setUpAssetsTestTrait(): void
4545 }
4646
4747 // Create the config
48- $ this ->config = config ( ' Assets ' );
48+ $ this ->config = new AssetsConfig ( );
4949 $ this ->config ->directory = $ this ->root ->url () . DIRECTORY_SEPARATOR ;
5050 $ this ->config ->useTimestamps = false ; // These make testing much harder
5151
@@ -64,6 +64,8 @@ protected function tearDownAssetsTestTrait(): void
6464 $ this ->root = null ;
6565 $ this ->published = false ;
6666 }
67+
68+ Asset::useConfig (null );
6769 }
6870
6971 /**
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public function testUsesConfig()
3434 $ result = Asset::config ();
3535
3636 $ this ->assertSame ($ config , $ result );
37- $ this ->assertNotSame (config (AssetsConfig::class), $ result );
37+ $ this ->assertSame (config (AssetsConfig::class), $ result );
3838 }
3939
4040 public function testLoadsConfig ()
You can’t perform that action at this time.
0 commit comments