Exemplo n.º 1
0
 public function testMagicMethod()
 {
     $schema = new Mongo_Mongo_Schema();
     Epic_Mongo::addSchema('magic', $schema);
     $this->assertInstanceOf('Mongo_Mongo_Schema', Epic_Mongo::magic());
     $this->assertInstanceOf('Mongo_Mongo_Document_Test', Epic_Mongo::magic('test'));
 }
 public function testAddSchema()
 {
     Epic_Mongo::addSchema('testCollection', new Collection_Mongo_Schema());
     $this->assertInstanceOf('Epic_Mongo_Schema', Epic_Mongo::getSchema('testCollection'));
 }
Exemplo n.º 3
0
 public function setUp()
 {
     $this->_db = MongoDb_TestHarness::getInstance()->dbName;
     Epic_Mongo::addSchema('db', new Test_Aggregate_Mongo_Schema());
 }
Exemplo n.º 4
0
*/
Autoloader::map(array('Epic_Mongo' => path('bundle') . '/epic_mongo/Mongo.php'));
// Ensure the User has created the epicmongo.php config file in application/config
if (!Config::has('epicmongo')) {
    throw new Exception("Please create 'epicmongo.php' in your application/config folder (template found in bundles/epic_mongo/examples/laravel_config).");
}
// Establish a Default Connection
Epic_Mongo::addConnection('default', Config::get('epicmongo.host'));
// Include the Laravel Schema
require_once dirname(__FILE__) . "/Mongo/Schema/Laravel.php";
// Load the default schema and ensure it exists
$schema = Config::get('epicmongo.schema');
if (!Config::has('epicmongo.schema')) {
    throw new Exception("Schema not found, please specify a schema in 'EpicMongo.php' in your application/config folder (example found on the template found in bundles/epic_mongo/examples/laravel_config).");
}
// Add the Schema to EpicMongo
Epic_Mongo::addSchema('db', new $schema());
// Include the Laravel Auth
require_once dirname(__FILE__) . "/Mongo/Auth/Laravel.php";
Auth::extend('epic_mongo', function () {
    return new Epic_Mongo_Auth_Laravel(Config::get('auth.model'));
});
//
// Testing Authentication
//
// $credentials = array('username' => 'username', 'password' => 'password');
//
// if (Auth::attempt($credentials))
// {
// 	var_dump(Auth::user()->email); exit;
// }