File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 "strategy" : " semver" ,
33 "major" : 0 ,
44 "minor" : 9 ,
5- "patch" : 1 ,
5+ "patch" : 2 ,
66 "build" : 0
77}
Original file line number Diff line number Diff line change 1+ ## 0.9.2 2026-01-02
2+
13## 0.9.1 2025-12-11
24* ** Nightwatch destination now uses system abstractions** - Refactored to use ` IHttpClient ` interface instead of direct curl calls
35* Added ` neuron-php/core ` 0.8.* dependency for system abstractions
Original file line number Diff line number Diff line change @@ -51,6 +51,13 @@ public function open( array $params ) : bool
5151 {
5252 $ this ->_name = $ this ->buildFileName ( $ params [ 'file_name ' ] );
5353
54+ // Create directory if it doesn't exist
55+ $ directory = dirname ( $ this ->_name );
56+ if ( !is_dir ( $ directory ) )
57+ {
58+ @mkdir ( $ directory , 0755 , true );
59+ }
60+
5461 $ this ->_file = @fopen ( $ this ->_name , 'a ' );
5562
5663 if ( !$ this ->_file )
Original file line number Diff line number Diff line change @@ -62,4 +62,33 @@ public function testWriteWithInvalidFileHandle()
6262 // Test passes if no exception is thrown
6363 $ this ->assertTrue ( true );
6464 }
65+
66+ public function testOpenCreatesDirectoryIfNotExists ()
67+ {
68+ $ tempDir = sys_get_temp_dir () . '/neuron_log_test_ ' . uniqid ();
69+ $ logFile = $ tempDir . '/logs/test.log ' ;
70+
71+ $ File = new File ( new CSV () );
72+
73+ // Directory should not exist yet
74+ $ this ->assertFalse ( is_dir ( dirname ( $ logFile ) ) );
75+
76+ // Open should succeed and create directory
77+ $ Pass = $ File ->open (
78+ [
79+ 'file_name ' => $ logFile
80+ ]
81+ );
82+
83+ $ this ->assertTrue ( $ Pass );
84+ $ this ->assertTrue ( is_dir ( dirname ( $ logFile ) ) );
85+ $ this ->assertTrue ( file_exists ( $ logFile ) );
86+
87+ $ File ->close ();
88+
89+ // Clean up
90+ @unlink ( $ logFile );
91+ @rmdir ( dirname ( $ logFile ) );
92+ @rmdir ( $ tempDir );
93+ }
6594}
You can’t perform that action at this time.
0 commit comments