/** * @expectedException Epic_Mongo_Exception */ public function testAddConnectionException() { Epic_Mongo::addConnection('default'); }
<?php $testFolder = dirname(__FILE__); require $testFolder . '/../Mongo.php'; if (file_exists($testFolder . '/config.php')) { require $testFolder . '/config.php'; } if (!defined('TEST_CONNECTION_STRING')) { define('TEST_CONNECTION_STRING', '127.0.0.1'); } Epic_Mongo::addConnection('default', TEST_CONNECTION_STRING); /** * @codeCoverageIgnore */ class MongoDb_TestHarness { private static $_instance = null; public static function getInstance() { if (static::$_instance) { return static::$_instance; } return static::$_instance = new self(); } public $dbName; private function __construct() { $this->dbName = 'test-' . md5(time() . rand()); $x = 1; while ($x <= 10000) { $doc = array('_id' => $x, 'v1' => $x % 10, 'v2' => $x * 10, 'v3' => $x * 100);
<?php /* Laravel Bundle Startup start.php */ 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');