Commit 7967464b authored by Taddeus Kroes's avatar Taddeus Kroes

Code cleanup.

parent caa0fc0d
...@@ -56,10 +56,15 @@ class FileNotFoundError extends \RuntimeException { ...@@ -56,10 +56,15 @@ class FileNotFoundError extends \RuntimeException {
} }
/** /**
* Format a string of the form 'foo %(bar)' with given parameters like array('bar' => 'some value'). * Format a string using parameters in an associative array.
*
* <code>
* echo asprintf('foo %(bar)', array('bar' => 'baz')); // prints 'foo baz'
* </code>
* *
* @param string $format The string to format. * @param string $format The string to format.
* @param array $params An associative array with parameters that are used in the format. * @param array $params An associative array with parameters that are used in $format.
* @package BasicWeb
*/ */
function asprintf($format, array $params) { function asprintf($format, array $params) {
return preg_replace_callback( return preg_replace_callback(
......
...@@ -6,16 +6,10 @@ use BasicWeb\Autoloader; ...@@ -6,16 +6,10 @@ use BasicWeb\Autoloader;
define('PATH', 'tests/_files/'); define('PATH', 'tests/_files/');
class AutoloaderTest extends PHPUnit_Framework_TestCase { class AutoloaderTest extends PHPUnit_Framework_TestCase {
var $autoloader;
function setUp() { function setUp() {
$this->autoloader = new Autoloader(PATH); $this->autoloader = new Autoloader(PATH);
} }
function tearDown() {
unset($this->autoloader);
}
function test_path_with_slash() { function test_path_with_slash() {
$this->assertEquals(Autoloader::path_with_slash('dirname'), 'dirname/'); $this->assertEquals(Autoloader::path_with_slash('dirname'), 'dirname/');
$this->assertEquals(Autoloader::path_with_slash('dirname/'), 'dirname/'); $this->assertEquals(Autoloader::path_with_slash('dirname/'), 'dirname/');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment