diff --git a/app/config/testing/database.php b/app/config/testing/database.php new file mode 100644 index 0000000000..b15c97c575 --- /dev/null +++ b/app/config/testing/database.php @@ -0,0 +1,14 @@ + 'sqlite', + + 'connections' => array( + 'sqlite' => array( + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '' + ), + ) +); \ No newline at end of file diff --git a/app/controllers/admin/ModelsController.php b/app/controllers/admin/ModelsController.php index d186f2f9d2..cdfc0eb956 100644 --- a/app/controllers/admin/ModelsController.php +++ b/app/controllers/admin/ModelsController.php @@ -38,7 +38,8 @@ class ModelsController extends AdminController { { // Show the page $depreciation_list = array('' => 'Do Not Depreciate') + Depreciation::lists('name', 'id'); - return View::make('backend/models/edit')->with('depreciation_list',$depreciation_list)->with('model',new Model); + $category_list = array('' => '') + DB::table('categories')->lists('name', 'id'); + return View::make('backend/models/edit')->with('category_list',$category_list)->with('depreciation_list',$depreciation_list)->with('model',new Model); } @@ -102,8 +103,8 @@ class ModelsController extends AdminController { } $depreciation_list = array('' => 'Do Not Depreciate') + Depreciation::lists('name', 'id'); - $model_options = array('' => 'Top Level') + DB::table('models')->where('id', '!=', $modelId)->lists('name', 'id'); - return View::make('backend/models/edit', compact('model'))->with('model_options',$model_options)->with('depreciation_list',$depreciation_list); + $category_list = array('' => '') + DB::table('categories')->lists('name', 'id'); + return View::make('backend/models/edit', compact('model'))->with('category_list',$category_list)->with('depreciation_list',$depreciation_list); } diff --git a/app/tests/TestCase.php b/app/tests/TestCase.php index 49b80fc274..c9f4d33996 100755 --- a/app/tests/TestCase.php +++ b/app/tests/TestCase.php @@ -2,6 +2,18 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase { + /** + * Default preparation for each test + * + */ + public function setUp() + { + parent::setUp(); // Don't forget this! + + $this->prepareForTests(); + } + + /** * Creates the application. * @@ -16,4 +28,15 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase { return require __DIR__.'/../../bootstrap/start.php'; } + /** + * Migrates the database and set the mailer to 'pretend'. + * This will cause the tests to run quickly. + * + */ + private function prepareForTests() + { + Artisan::call('migrate'); + Mail::pretend(true); + } + } diff --git a/app/views/backend/assets/edit.blade.php b/app/views/backend/assets/edit.blade.php index 6afa0956db..f62f525270 100755 --- a/app/views/backend/assets/edit.blade.php +++ b/app/views/backend/assets/edit.blade.php @@ -43,7 +43,7 @@