/usr/share/php/tests/Horde_Autoloader/Horde/Autoloader/ClassPathMapper/ApplicationTest.php is in php-horde-autoloader 2.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <?php
/**
* @category Horde
* @package Autoloader
*/
class Horde_Autoloader_ClassPathMapper_ApplicationTest extends PHPUnit_Framework_TestCase
{
private $_mapper;
public function setUp()
{
$this->_mapper = new Horde_Autoloader_ClassPathMapper_Application(
'app' // directory to app dir
);
$this->_mapper->addMapping('Suffix', 'subdir');
}
public function providerValidClassNames()
{
return array(
array('Module_Action_Suffix', 'app/subdir/Action.php'),
array('MyModule_Action_Suffix', 'app/subdir/Action.php'),
array('Module_MyAction_Suffix', 'app/subdir/MyAction.php'),
array('MyModule_MyAction_Suffix', 'app/subdir/MyAction.php'),
);
}
/**
* @dataProvider providerValidClassNames
*/
public function testShouldMapValidAppClassToAppPath($validClassName, $classPath)
{
$this->assertEquals(
$classPath,
$this->_mapper->mapToPath($validClassName)
);
}
public function providerInvalidClassNames()
{
return array(
array('Module_Action_BadSuffix'),
array('module_Action_Suffix'),
array('Module_action_Suffix'),
array('Module-Action-Suffix'),
array(''),
);
}
/**
* @dataProvider providerInvalidClassNames
*/
public function testShouldIgnoreInvalidAppClassNames($invalidClassName)
{
$this->assertNull($this->_mapper->mapToPath($invalidClassName));
}
}
|