@@ -484,8 +484,16 @@ public function storeConsoleLog($name)
484
484
$ console = $ this ->driver ->manage ()->getLog ('browser ' );
485
485
486
486
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
+
487
495
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 )
489
497
);
490
498
}
491
499
}
@@ -504,9 +512,15 @@ public function storeSource($name)
504
512
$ source = $ this ->driver ->getPageSource ();
505
513
506
514
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 );
510
524
}
511
525
512
526
return $ this ;
0 commit comments