mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
8534955572
Since functions defined in files referenced in 'files' section in composer autoload config are automatically loaded when composer autoloader is included (for example when Psalm is installed into project vendors), it's good idea to keep them namespaced. Otherwise it would prevent dependents to declare their own functions in the global namespace with the same names.
37 lines
908 B
PHP
37 lines
908 B
PHP
<?php
|
|
namespace Psalm\Tests;
|
|
|
|
use function Psalm\isAbsolutePath;
|
|
|
|
class IsAbsolutePathTest extends TestCase
|
|
{
|
|
/**
|
|
* @param string $path
|
|
* @param bool $expected
|
|
*
|
|
* @return void
|
|
*
|
|
* @dataProvider providerForTestIsAbsolutePath
|
|
*/
|
|
public function testIsAbsolutePath($path, $expected)
|
|
{
|
|
self::assertSame($expected, isAbsolutePath($path));
|
|
}
|
|
|
|
/**
|
|
* @return array<int, array{0:string, 1:bool}>
|
|
*/
|
|
public function providerForTestIsAbsolutePath()
|
|
{
|
|
return [
|
|
['/path/to/something', true],
|
|
['/path/to/something/file.php', true],
|
|
['relative/path/to/something', false],
|
|
['relative/path/to/something/file.php', false],
|
|
['c:/path/to/something', true],
|
|
['file://c:/path/to/something', true],
|
|
['zlib://c:/path/to/something', true],
|
|
];
|
|
}
|
|
}
|