File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ public function load($filename)
3535 throw new ProfilerException ("File does not exist: $ filename " );
3636 }
3737 $ config = require $ filename ;
38+ if ($ config === 1 ) {
39+ throw new ProfilerException ("Config did not return an array: $ filename " );
40+ }
3841 $ this ->merge ($ config );
3942 }
4043
Original file line number Diff line number Diff line change @@ -19,4 +19,14 @@ public function testLoadConfig()
1919 $ config ->load (__DIR__ . '/Resources/config_saver.php ' );
2020 $ this ->assertEquals (Profiler::SAVER_UPLOAD , $ config ['save.handler ' ]);
2121 }
22+
23+ /**
24+ * @expectedException \Xhgui\Profiler\Exception\ProfilerException
25+ * @expectedExceptionMessage Config did not return an array
26+ */
27+ public function testBadConfig ()
28+ {
29+ $ config = new Config ();
30+ $ config ->load (__DIR__ . '/Resources/config_bad_return.php ' );
31+ }
2232}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Xhgui \Profiler \Profiler ;
4+
5+ $ config = array (
6+ 'save.handler ' => Profiler::SAVER_UPLOAD ,
7+ );
You can’t perform that action at this time.
0 commit comments