File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,9 @@ function __toString(){
4040 * for docs, check \Chevron\Widgets\WidgetInterface
4141 */
4242 function render (){
43+ if ( !file_exists ($ this ->file ) ){
44+ throw new \RuntimeException ("Not a file: ' {$ this ->file }' " );
45+ }
4346 return require ($ this ->file );
4447 }
4548
@@ -61,10 +64,6 @@ function __get($key){
6164 * change the base layout
6265 */
6366 protected function setFile ($ file ){
64- if ( !file_exists ($ file ) ){
65- throw new \InvalidArgumentException ("Not a file: {$ file }" );
66- }
67-
6867 $ this ->file = $ file ;
6968 }
7069
Original file line number Diff line number Diff line change @@ -10,11 +10,12 @@ function test___construct(){
1010 }
1111
1212 /**
13- * @expectedException \InvalidArgumentException
13+ * @expectedException \RuntimeException
1414 */
1515 function test___construct_exception (){
1616 $ widget = new Widget (__DIR__ ."/exampleNOTView.php " );
1717 $ this ->assertTrue (($ widget InstanceOf Widget));
18+ $ widget ->render ();
1819 }
1920
2021 function test___get (){
You can’t perform that action at this time.
0 commit comments