@@ -484,8 +484,16 @@ public function storeConsoleLog($name)
484484 $ console = $ this ->driver ->manage ()->getLog ('browser ' );
485485
486486 if (! empty ($ console )) {
487+ $ filePath = sprintf ('%s/%s.log ' , rtrim (static ::$ storeConsoleLogAt , '/ ' ), $ name );
488+
489+ $ directoryPath = dirname ($ filePath );
490+
491+ if (! is_dir ($ directoryPath )) {
492+ mkdir ($ directoryPath , 0777 , true );
493+ }
494+
487495 file_put_contents (
488- sprintf ( ' %s/%s.log ' , rtrim ( static :: $ storeConsoleLogAt , ' / ' ), $ name ) , json_encode ($ console , JSON_PRETTY_PRINT )
496+ $ filePath , json_encode ($ console , JSON_PRETTY_PRINT )
489497 );
490498 }
491499 }
@@ -504,9 +512,15 @@ public function storeSource($name)
504512 $ source = $ this ->driver ->getPageSource ();
505513
506514 if (! empty ($ source )) {
507- file_put_contents (
508- sprintf ('%s/%s.txt ' , rtrim (static ::$ storeSourceAt , '/ ' ), $ name ), $ source
509- );
515+ $ filePath = sprintf ('%s/%s.txt ' , rtrim (static ::$ storeSourceAt , '/ ' ), $ name );
516+
517+ $ directoryPath = dirname ($ filePath );
518+
519+ if (! is_dir ($ directoryPath )) {
520+ mkdir ($ directoryPath , 0777 , true );
521+ }
522+
523+ file_put_contents ($ filePath , $ source );
510524 }
511525
512526 return $ this ;
0 commit comments