本文整理汇总了PHP中ConnectionFactory::create方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionFactory::create方法的具体用法?PHP ConnectionFactory::create怎么用?PHP ConnectionFactory::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionFactory
的用法示例。
在下文中一共展示了ConnectionFactory::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreate
public function testCreate()
{
$dbInstance = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap()->getApplication()->getDbInstance();
$dbConfig = ['host' => $dbInstance->getHost(), 'username' => $dbInstance->getUser(), 'password' => $dbInstance->getPassword(), 'dbname' => $dbInstance->getSchema(), 'active' => true];
$connection = $this->model->create($dbConfig);
$this->assertInstanceOf('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface', $connection);
}
示例2: create
/**
* Create a new RconMessenger
*
* @param $host
* @param $port
* @param $password
*
* @return \gries\Rcon\Messenger
*/
public static function create($host, $port, $password)
{
$connection = ConnectionFactory::create($host, $port, $password);
return new Messenger($connection);
}
示例3: testRepositoryFindItems
/**
* @depends testRepositoryInsertItem
*/
public function testRepositoryFindItems()
{
$dbConn = ConnectionFactory::create($this->dbUrl);
$repo = new Repository($dbConn);
$repoClass = new \ReflectionClass($repo);
$repoMethod = $repoClass->getMethod('findItems');
$repoMethod->setAccessible(true);
$users = $repoMethod->invoke($repo, 'users');
$this->assertEquals(1, count($users));
$this->assertEquals('ahundiak', $users[0]['userName']);
}