getMethod('getHomeDirectory'); $method->setAccessible(true); $this->assertEquals('C:\\Users\\Support', $method->invoke(null)); } /** * @depends testGetsHomeDirectoryForWindowsUser * @throws ReflectionException */ public function testGetsHomeDirectoryForLinuxUser() { putenv('HOME=/root'); putenv('HOMEDRIVE='); putenv('HOMEPATH='); $ref = new ReflectionClass(OS::class); $method = $ref->getMethod('getHomeDirectory'); $method->setAccessible(true); $this->assertEquals('/root', $method->invoke(null)); } }