mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
CS tweaks and cleanups, allow "" to set fallback dirs, refs #2459
This commit is contained in:
parent
b23742e30c
commit
3c5000ad7f
6 changed files with 59 additions and 76 deletions
|
@ -14,13 +14,9 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
*
|
||||
* @dataProvider getLoadClassTests
|
||||
*
|
||||
* @param string $class
|
||||
* The fully-qualified class name to test,
|
||||
* without preceding namespace separator.
|
||||
* @param bool $prependSeparator
|
||||
* Whether to call ->loadClass() with a class name with preceding
|
||||
* namespace separator, as it happens in PHP 5.3.0 - 5.3.2.
|
||||
* See https://bugs.php.net/50731
|
||||
* @param string $class The fully-qualified class name to test, without preceding namespace separator.
|
||||
* @param bool $prependSeparator Whether to call ->loadClass() with a class name with preceding
|
||||
* namespace separator, as it happens in PHP 5.3.0 - 5.3.2. See https://bugs.php.net/50731
|
||||
*/
|
||||
public function testLoadClass($class, $prependSeparator = FALSE)
|
||||
{
|
||||
|
@ -30,12 +26,11 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
$loader->addPsr4('ShinyVendor\\ShinyPackage\\', __DIR__ . '/Fixtures');
|
||||
|
||||
if ($prependSeparator) {
|
||||
$prepend = '\\';
|
||||
$message = "->loadClass() loads '$class'.";
|
||||
}
|
||||
else {
|
||||
$prepend = '';
|
||||
$message = "->loadClass() loads '\\$class', as required in PHP 5.3.0 - 5.3.2.";
|
||||
$prepend = '\\';
|
||||
$message = "->loadClass() loads '$class'.";
|
||||
} else {
|
||||
$prepend = '';
|
||||
$message = "->loadClass() loads '\\$class', as required in PHP 5.3.0 - 5.3.2.";
|
||||
}
|
||||
|
||||
$loader->loadClass($prepend . $class);
|
||||
|
@ -45,8 +40,7 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* Provides arguments for ->testLoadClass().
|
||||
*
|
||||
* @return array
|
||||
* Array of parameter sets to test with.
|
||||
* @return array Array of parameter sets to test with.
|
||||
*/
|
||||
public function getLoadClassTests()
|
||||
{
|
||||
|
@ -56,10 +50,9 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
array('ShinyVendor\\ShinyPackage\\SubNamespace\\Foo'),
|
||||
// "Bar" would not work here, since it is defined in a ".inc" file,
|
||||
// instead of a ".php" file. So, use "Baz" instead.
|
||||
array('Namespaced\\Baz', '\\'),
|
||||
array('Pearlike_Bar', '\\'),
|
||||
array('ShinyVendor\\ShinyPackage\\SubNamespace\\Bar', '\\'),
|
||||
array('Namespaced\\Baz', true),
|
||||
array('Pearlike_Bar', true),
|
||||
array('ShinyVendor\\ShinyPackage\\SubNamespace\\Bar', true),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue