Created
September 17, 2011 21:00
-
-
Save xenji/1224362 to your computer and use it in GitHub Desktop.
DescribeNewAutoloaderConfiguration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sDir = realpath(dirname(__FILE__) . '/../../'); | |
$aPaths = array( | |
$sDir . '/backend/library', | |
$sDir . '/frontend/library', | |
$sDir . '/shared/library', | |
); | |
set_include_path(get_include_path() . PATH_SEPARATOR . join(PATH_SEPARATOR, $aPaths)); | |
spl_autoload_register(function($sClass){ | |
require_once join(DIRECTORY_SEPARATOR, explode('\\', $sClass)) . '.php'; | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ePress\test\Autoloader; | |
require_once dirname(__FILE__) . '/../../../../../bootstrap.php'; | |
use \Mockery as m; | |
use \ePress\Impl\Autoloader\DefaultConfiguration; | |
class DescribeNewAutoloaderConfiguration extends \PHPSpec\Context { | |
/** | |
* Fixture for the paths | |
* @var array | |
*/ | |
private $aPaths = array('/test', '/test2'); | |
/** | |
* @return void | |
*/ | |
public function itShouldReturnThePathsFromConstructor() | |
{ | |
$oConfig = new DefaultConfiguration($this->aPaths); | |
$this->spec(sizeof($oConfig->getIncludePaths()))->should->beEqualTo(2); // This works fine (skalar value) | |
$this->spec(array('a', 'b'))->should->beArray(); // this is crazy -> seems to want to load a.php via autoloader?? | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment