public function getAuthInstance() { $dbFactory = new DbFactory(); $storage = $dbFactory->getSqlStorage(DB_CTCRM); $userMapper = new Mapper($storage, 'users'); $authService = new \Auth($userMapper, array('id' => 'username', 'pw' => 'password')); return new Authenticator($authService); }
public static function createTestDatabase() { try { $factory = new Factory(); $handler = $factory->getDbConnection('testdb'); $handler->query(readfile(__DIR__ . '_files/create_testdb.sql')); } catch (Exception $e) { echo $e->getMessage() . PHP_EOL; } }
/** * @group integration */ public function setUp() { $factory = new Factory(); $this->handler = $factory->getDbConnection('testdb'); // Helper_TestDatabaseCreator::createTestDatabase(); }
public function getArticleDataService() { $dbFactory = new Factory(); $handler = $dbFactory->getDbConnection('ctcrm'); return new ArticleDataService($handler); }
public function testHandlerIsReturnedWhenTestDbIsRequested() { $this->assertInstanceOf('ctcrm\\database\\Handler', $this->factory->getDbConnection($this->testSetup['database'])); }