Skip to content

Instantly share code, notes, and snippets.

@xenji
Created September 17, 2011 21:00
Show Gist options
  • Save xenji/1224362 to your computer and use it in GitHub Desktop.
Save xenji/1224362 to your computer and use it in GitHub Desktop.
DescribeNewAutoloaderConfiguration
<?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';
});
<?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