From 813cd0d3b8c74ee31e92aed40258f5c34024d1f8 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 18 Jan 2012 14:13:50 -0600 Subject: [PATCH] finish autoloader tests. --- tests/cases/laravel/autoloader.test.php | 28 +++++++++++++++++++++++++ tests/laravel/dashboard/repository.php | 7 +++++++ tests/laravel/models/autoloader.php | 3 +++ 3 files changed, 38 insertions(+) create mode 100644 tests/laravel/dashboard/repository.php create mode 100644 tests/laravel/models/autoloader.php diff --git a/tests/cases/laravel/autoloader.test.php b/tests/cases/laravel/autoloader.test.php index 9aafa330..7d860b32 100644 --- a/tests/cases/laravel/autoloader.test.php +++ b/tests/cases/laravel/autoloader.test.php @@ -71,4 +71,32 @@ public function testPsrLibrariesAndModelsCanBeLoaded() $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); + } + } \ No newline at end of file diff --git a/tests/laravel/dashboard/repository.php b/tests/laravel/dashboard/repository.php new file mode 100644 index 00000000..7f6b3a7f --- /dev/null +++ b/tests/laravel/dashboard/repository.php @@ -0,0 +1,7 @@ +