本文整理汇总了PHP中TestHelper::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP TestHelper::getConfig方法的具体用法?PHP TestHelper::getConfig怎么用?PHP TestHelper::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestHelper
的用法示例。
在下文中一共展示了TestHelper::getConfig方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (\TestHelper::getConfig()->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$this->config = array('siteid' => 1);
$this->config['search'] = array('cache.id' => array('label' => 'Cache ID', 'code' => 'cache.id', 'internalcode' => 'id', 'type' => 'string', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR), 'cache.siteid' => array('label' => 'Cache site ID', 'code' => 'cache.siteid', 'internalcode' => 'siteid', 'type' => 'integer', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT), 'cache.value' => array('label' => 'Cached value', 'code' => 'cache.value', 'internalcode' => 'value', 'type' => 'string', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR), 'cache.expire' => array('label' => 'Cache expiration date', 'code' => 'cache.expire', 'internalcode' => 'expire', 'type' => 'datetime', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR), 'cache.tag.name' => array('label' => 'Cache tag name', 'code' => 'cache.tag.name', 'internalcode' => 'tname', 'type' => 'string', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR));
$this->config['sql'] = array('delete' => '
DELETE FROM "mw_cache_test" WHERE "siteid" = ? AND :cond
', 'deletebytag' => '
DELETE FROM "mw_cache_test" WHERE "siteid" = ? AND id IN (
SELECT "tid" FROM "mw_cache_tag_test" WHERE "tsiteid" = ? AND :cond
)
', 'get' => '
SELECT "id", "value", "expire" FROM "mw_cache_test" WHERE "siteid" = ? AND :cond
', 'getbytag' => '
SELECT "id", "value", "expire" FROM "mw_cache_test"
JOIN "mw_cache_tag_test" ON "tid" = "id"
WHERE siteid = ? AND tsiteid = ? AND :cond
', 'set' => '
INSERT INTO "mw_cache_test" ( "id", "siteid", "expire", "value" ) VALUES ( ?, ?, ?, ? )
', 'settag' => '
INSERT INTO "mw_cache_tag_test" ( "tid", "tsiteid", "tname" ) VALUES ( ?, ?, ? )
');
$this->dbm = \TestHelper::getDBManager();
$conn = $this->dbm->acquire();
$sql = 'DROP TABLE IF EXISTS "mw_cache_tag_test"';
$conn->create($sql)->execute()->finish();
$sql = 'DROP TABLE IF EXISTS "mw_cache_test"';
$conn->create($sql)->execute()->finish();
$sql = '
CREATE TABLE IF NOT EXISTS "mw_cache_test" (
"id" VARCHAR(255) NOT NULL,
"siteid" INTEGER NULL,
"expire" DATETIME NULL,
"value" MEDIUMTEXT NOT NULL,
KEY ("expire"),
CONSTRAINT PRIMARY KEY ("id", "siteid")
);
';
$conn->create($sql)->execute()->finish();
$sql = '
CREATE TABLE IF NOT EXISTS "mw_cache_tag_test" (
"tid" VARCHAR(255) NOT NULL,
"tsiteid" INTEGER NULL,
"tname" VARCHAR(255) NOT NULL,
CONSTRAINT UNIQUE ("tid", "tsiteid", "tname"),
CONSTRAINT FOREIGN KEY ("tid") REFERENCES "mw_cache_test" ("id") ON DELETE CASCADE
);
';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_cache_test" ("id", "siteid", "expire", "value") VALUES (\'t:1\', 1, NULL, \'test 1\')';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_cache_test" ("id", "siteid", "expire", "value") VALUES (\'t:2\', 1, \'2000-01-01 00:00:00\', \'test 2\')';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_cache_tag_test" ("tid", "tsiteid", "tname") VALUES (\'t:1\', 1, \'tag:1\')';
$conn->create($sql)->execute()->finish();
$this->dbm->release($conn);
$this->object = new \Aimeos\MW\Cache\DB($this->config, $this->dbm);
}
示例2: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (TestHelper::getConfig()->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$dbm = TestHelper::getDBManager();
$this->_conn = $dbm->acquire();
}
示例3: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->config = \TestHelper::getConfig();
if ($this->config->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$this->dbm = \TestHelper::getDBManager();
}
示例4: tearDown
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
*/
protected function tearDown()
{
if (TestHelper::getConfig()->get('resource/db/adapter', false) === false) {
return;
}
$this->_dbm = TestHelper::getDBManager();
$conn = $this->_dbm->acquire();
$conn->create('DROP TABLE "mw_log_test"')->execute()->finish();
$this->_dbm->release($conn);
}
示例5: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (\TestHelper::getConfig()->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$dbm = \TestHelper::getDBManager();
$conn = $dbm->acquire();
$this->object = new \Aimeos\MW\Criteria\SQL($conn);
$dbm->release($conn);
}
示例6: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$config = TestHelper::getConfig();
if ($config->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$dbm = TestHelper::getDBManager();
$conn = $dbm->acquire();
$schema = new MW_Setup_DBSchema_Mysql($conn, $config->get('resource/db/database', 'notfound'));
$this->_object = new MW_Setup_Task_AbstractImpl($schema, $conn);
$dbm->release($conn);
}
示例7: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$config = \TestHelper::getConfig();
if ($config->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$dbm = \TestHelper::getDBManager();
$conn = $dbm->acquire();
$schema = new \Aimeos\MW\Setup\DBSchema\Mysql($conn, $config->get('resource/db/database', 'notfound'));
$this->object = new BaseImpl($schema, $conn);
$dbm->release($conn);
}
示例8: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (TestHelper::getConfig()->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$this->_dbm = TestHelper::getDBManager();
$conn = $this->_dbm->acquire();
$conn->create('
CREATE TABLE IF NOT EXISTS "mw_log_test" (
"facility" VARCHAR(32) NOT NULL,
"request" VARCHAR(32) NOT NULL,
"tstamp" VARCHAR(20) NOT NULL,
"priority" INTEGER NOT NULL,
"message" TEXT NOT NULL
);')->execute()->finish();
$sql = 'INSERT INTO "mw_log_test" ( "facility", "tstamp", "priority", "message", "request" ) VALUES ( ?, ?, ?, ?, ? )';
$this->_object = new MW_Logger_DB($conn->create($sql));
$this->_dbm->release($conn);
}
示例9: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$config = TestHelper::getConfig();
if ($config->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$this->_dbm = TestHelper::getDBManager();
$conn = $this->_dbm->acquire();
$sql = '
CREATE TABLE IF NOT EXISTS "mw_setup_dbschema_test" (
"integer" INTEGER NOT NULL AUTO_INCREMENT,
"varchar16" VARCHAR(16) NOT NULL DEFAULT \'default\',
"smallint" SMALLINT NOT NULL,
"integernull" INTEGER,
CONSTRAINT "unq_mwsdt_integer" UNIQUE ("integer")
);
';
$conn->create($sql)->execute()->finish();
$conn->create('CREATE INDEX "idx_msdt_smallint" ON "mw_setup_dbschema_test" ("smallint")')->execute()->finish();
$this->_object = new MW_Setup_DBSchema_Mysql($conn, $config->get('resource/db/database', 'notfound'));
$this->_dbm->release($conn);
}
示例10: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (\TestHelper::getConfig()->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
$this->config = array();
$this->config['search'] = array('id' => array('label' => 'Tree node ID', 'code' => 'tree.id', 'internalcode' => 'id', 'type' => 'integer', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT), 'parentid' => array('label' => 'Tree node parent id', 'code' => 'tree.parentid', 'internalcode' => 'parentid', 'type' => 'integer', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT), 'label' => array('label' => 'Tree node name', 'code' => 'tree.label', 'internalcode' => 'label', 'type' => 'string', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR), 'code' => array('label' => 'Tree node code', 'code' => 'tree.code', 'internalcode' => 'code', 'type' => 'string', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR), 'status' => array('label' => 'Tree node status', 'code' => 'tree.status', 'internalcode' => 'status', 'type' => 'boolean', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_BOOL), 'level' => array('label' => 'Tree node level', 'code' => 'tree.level', 'internalcode' => 'level', 'type' => 'integer', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT), 'left' => array('label' => 'Tree node left number', 'code' => 'tree.left', 'internalcode' => 'nleft', 'type' => 'integer', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT), 'right' => array('label' => 'Tree node right number', 'code' => 'tree.right', 'internalcode' => 'nright', 'type' => 'integer', 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT));
$this->config['sql'] = array('delete' => '
DELETE FROM "mw_tree_test" WHERE nleft >= ? AND nright <= ?
', 'get' => '
SELECT
node."id", node."label", node."code", node."status", node."level",
node."parentid", node."nleft" AS "left", node."nright" AS "right"
FROM "mw_tree_test" AS parent, "mw_tree_test" AS node
WHERE
node.nleft >= parent.nleft AND node.nleft <= parent.nright
AND parent.id = ? AND node.level <= parent.level + ?
AND :cond
ORDER BY node.nleft
', 'insert' => '
INSERT INTO "mw_tree_test" ( label, code, status, parentid, level, nleft, nright ) VALUES ( ?, ?, ?, ?, ?, ?, ? )
', 'move-left' => '
UPDATE "mw_tree_test"
SET nleft = nleft + ?, level = level + ?
WHERE nleft >= ? AND nleft <= ?
', 'move-right' => '
UPDATE "mw_tree_test"
SET nright = nright + ?
WHERE nright >= ? AND nright <= ?
', 'search' => '
SELECT "id", "label", "code", "status", "level", "nleft" AS "left", "nright" AS "right"
FROM "mw_tree_test" AS node
WHERE nleft >= ? AND nright <= ? AND :cond
ORDER BY :order
', 'update' => '
UPDATE "mw_tree_test" SET label = ?, code = ?, status = ? WHERE id = ?
', 'update-parentid' => '
UPDATE "mw_tree_test" SET parentid = ? WHERE id = ?
', 'newid' => '
SELECT LAST_INSERT_ID()
', 'transstart' => 'BEGIN', 'transcommit' => 'COMMIT', 'transrollback' => 'ROLLBACK');
$this->dbm = \TestHelper::getDBManager();
$conn = $this->dbm->acquire();
$sql = 'DROP TABLE IF EXISTS "mw_tree_test"';
$conn->create($sql)->execute()->finish();
$sql = '
CREATE TABLE IF NOT EXISTS "mw_tree_test" (
"id" INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
"parentid" INTEGER NOT NULL,
"label" VARCHAR(16) NOT NULL,
"code" VARCHAR(32) NOT NULL,
"level" INTEGER NOT NULL,
"nleft" INTEGER NOT NULL,
"nright" INTEGER NOT NULL,
"status" SMALLINT NOT NULL
);
';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (parentid, status, label, code, level, nleft, nright) VALUES (0, 1, \'root\', \'root\', 0, 1, 18)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'l1n1\', \'l1n1\', 1, 2, 7)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'l2n1\', \'l2n1\', 2, 3, 6)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'l3n1\', \'l3n1\', 3, 4, 5)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'l1n2\', \'l1n2\', 1, 8, 15)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'l2n2\', \'l2n2\', 2, 9, 14)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'l3n2\', \'l3n2\', 3, 10, 11)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'l3n3\', \'l3n3\', 3, 12, 13)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'l1n3\', \'l1n3\', 1, 16, 17)';
$conn->create($sql)->execute()->finish();
$sql = 'INSERT INTO "mw_tree_test" (status, label, code, level, nleft, nright) VALUES (1, \'root2\', \'root2\', 0, 19, 20)';
$conn->create($sql)->execute()->finish();
$this->dbm->release($conn);
}
示例11: testFactoryFail
public function testFactoryFail()
{
$this->setExpectedException('MW_DB_Exception');
MW_DB_Factory::createManager(TestHelper::getConfig(), 'notDefined');
}
示例12: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (TestHelper::getConfig()->get('resource/db/adapter', false) === false) {
$this->markTestSkipped('No database configured');
}
}
示例13: testFactoryFail
public function testFactoryFail()
{
$this->setExpectedException('\\Aimeos\\MW\\DB\\Exception');
\Aimeos\MW\DB\Factory::createManager(\TestHelper::getConfig(), 'notDefined');
}