1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00
psalm/tests/IsAbsolutePathTest.php
Bruce Weirdan 8534955572 Namespace autoloaded functions (#1724)
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.
2019-06-02 11:23:25 -04:00

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],
];
}
}