finish autoloader tests.
This commit is contained in:
@@ -71,4 +71,32 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase {
|
||||
$this->assertInstanceOf('Repositories\\User', new Repositories\User);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the loading of hard-coded classes.
|
||||
*
|
||||
* @group laravel
|
||||
*/
|
||||
public function testHardcodedClassesCanBeLoaded()
|
||||
{
|
||||
Autoloader::map(array(
|
||||
'Autoloader_HardCoded' => APP_PATH.'models'.DS.'autoloader.php',
|
||||
));
|
||||
|
||||
$this->assertInstanceOf('Autoloader_HardCoded', new Autoloader_HardCoded);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the loading of classes mapped by namespaces.
|
||||
*
|
||||
* @group laravel
|
||||
*/
|
||||
public function testClassesMappedByNamespaceCanBeLoaded()
|
||||
{
|
||||
Autoloader::namespaces(array(
|
||||
'Dashboard' => APP_PATH.'dashboard',
|
||||
));
|
||||
|
||||
$this->assertInstanceOf('Dashboard\\Repository', new Dashboard\Repository);
|
||||
}
|
||||
|
||||
}
|
||||
7
tests/laravel/dashboard/repository.php
Normal file
7
tests/laravel/dashboard/repository.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php namespace Dashboard;
|
||||
|
||||
/**
|
||||
* This class is used for testing the auto-loading of classes
|
||||
* that are mapped by namesapce.
|
||||
*/
|
||||
class Repository {}
|
||||
3
tests/laravel/models/autoloader.php
Normal file
3
tests/laravel/models/autoloader.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
class Autoloader_HardCoded {}
|
||||
Reference in New Issue
Block a user