123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace Composer\Test\Util;
- use Composer\Util\Platform;
- use Composer\Test\TestCase;
- class PlatformTest extends TestCase
- {
- public function testExpandPath()
- {
- putenv('TESTENV=/home/test');
- $this->assertEquals('/home/test/myPath', Platform::expandPath('%TESTENV%/myPath'));
- $this->assertEquals('/home/test/myPath', Platform::expandPath('$TESTENV/myPath'));
- $this->assertEquals((getenv('HOME') ?: getenv('USERPROFILE')) . '/test', Platform::expandPath('~/test'));
- }
- public function testIsWindows()
- {
-
- $this->assertEquals(('\\' === DIRECTORY_SEPARATOR), Platform::isWindows());
- $this->assertEquals(defined('PHP_WINDOWS_VERSION_MAJOR'), Platform::isWindows());
- }
- }
|