Skip to content

Commit dd1de7c

Browse files
committed
Added tests for boot functions. Added namespace for boot functions.
1 parent 9ed0429 commit dd1de7c

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

.version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"strategy": "semver",
33
"major": 0,
44
"minor": 6,
5-
"patch": 40,
5+
"patch": 39,
66
"build": 0
77
}

tests/BootstrapTest.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,16 @@ public function testBootWithDefaultBasePath()
143143
->at( $this->Root )
144144
->setContent( $VersionContent );
145145

146-
// Boot with non-existent config path - should use default '.'
147-
// Since we can't easily change CWD in tests, this will use actual CWD
148-
// We'll create a temp version file to test
149-
$TempVersionFile = './.version.json';
146+
// Create a temporary directory for this test
147+
$TempDir = sys_get_temp_dir() . '/neuron_test_' . uniqid();
148+
mkdir( $TempDir );
149+
$TempVersionFile = $TempDir . '/.version.json';
150150
file_put_contents( $TempVersionFile, $VersionContent );
151151

152+
// Save original CWD and change to temp directory
153+
$OriginalCwd = getcwd();
154+
chdir( $TempDir );
155+
152156
try
153157
{
154158
// Boot with non-existent config path - will use current directory
@@ -160,8 +164,11 @@ public function testBootWithDefaultBasePath()
160164
}
161165
finally
162166
{
163-
// Clean up
167+
// Restore original directory
168+
chdir( $OriginalCwd );
169+
// Clean up temp files
164170
@unlink( $TempVersionFile );
171+
@rmdir( $TempDir );
165172
}
166173
}
167174

@@ -291,9 +298,9 @@ public function testLegacyBootstrap()
291298

292299
public function testLegacyMissingConfig()
293300
{
294-
// With the fix, this should now fall back to environment/default path
295-
// Will still throw exception if version file not found
296-
$this->expectException( \Exception::class );
301+
// With the fix, this now falls back to environment/default path
302+
// Since there's a .version.json in current directory, it will succeed
297303
$App = Boot( 'examples/non-there' );
304+
$this->assertInstanceOf( Application::class, $App );
298305
}
299306
}

versionlog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 0.6.39
22

33
* Added namespace to the bootstrap functions.
4+
* Added tests.
45

56
## 0.6.38 2025-08-05
67

0 commit comments

Comments
 (0)