/**
  * Tests converting a path to a fully-qualified namespace.
  * 
  * @dataProvider pathToNamespaceProvider
  * @covers empire\framework\autoload\Psr4AutoLoader::pathToNamespace
  * @param array $namespaces the namespaces to add
  * @param string $path the path to convert
  * @param string|boolean $expected the expected result
  */
 public function testPathToNamespace($namespaces, $path, $expected)
 {
     foreach ($namespaces as $namespace => $baseDirectory) {
         $this->instance->addNamespace($namespace, $baseDirectory);
     }
     $this->assertSame($expected, $this->instance->pathToNamespace($path));
 }
Exemple #2
0
<?php

/**
 * Bootstrap code.
 */
use empire\framework\autoload\psr4\Psr4AutoLoader;
use empire\framework\error\ErrorHandler;
// Register PSR-4 autoloader
$classPath = __DIR__ . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . 'psr4' . DIRECTORY_SEPARATOR . 'Psr4AutoLoader.php';
require_once $classPath;
$autoLoader = new Psr4AutoLoader();
$autoLoader->addNamespace('empire\\framework', __DIR__ . DIRECTORY_SEPARATOR . 'framework');
$autoLoader->register();
// Register error handler
$errorHandler = new ErrorHandler();
$errorHandler->register();
// Load PHPUnit
require_once 'PHPUnit/Autoload.php';