Esempio n. 1
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     $this->_dbm = TestHelper::getDBManager();
     $conn = $this->_dbm->acquire();
     $conn->create('DROP INDEX "idx_msdt_smallint" ON "mw_setup_dbschema_test"')->execute()->finish();
     $conn->create('DROP TABLE "mw_setup_dbschema_test"')->execute()->finish();
     $this->_dbm->release($conn);
 }
Esempio n. 2
0
 /**
  * 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();
 }
Esempio n. 3
0
 /**
  * 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);
 }
Esempio n. 4
0
 /**
  * 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);
 }
Esempio n. 5
0
 /**
  * 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);
 }
Esempio n. 6
0
 /**
  * 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);
 }
Esempio n. 7
0
    /**
     * 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);
    }
Esempio n. 8
0
 public function testToString()
 {
     $dbm = TestHelper::getDBManager();
     $conn = $dbm->acquire();
     $dbm->release($conn);
     $types = array('list' => MW_DB_Statement_Abstract::PARAM_STR, 'string' => MW_DB_Statement_Abstract::PARAM_STR, 'float' => MW_DB_Statement_Abstract::PARAM_FLOAT, 'int' => MW_DB_Statement_Abstract::PARAM_INT, 'undefined' => MW_DB_Statement_Abstract::PARAM_INT, 'bool' => MW_DB_Statement_Abstract::PARAM_BOOL);
     $expr1 = array();
     $expr1[] = new MW_Common_Criteria_Expression_Compare_SQL($conn, '==', 'list', array('a', 'b', 'c'));
     $expr1[] = new MW_Common_Criteria_Expression_Compare_SQL($conn, '~=', 'string', 'value');
     $expr2 = array();
     $expr2[] = new MW_Common_Criteria_Expression_Compare_SQL($conn, '<', 'float', 0.1);
     $expr2[] = new MW_Common_Criteria_Expression_Compare_SQL($conn, '>', 'int', 10);
     $objects = array();
     $objects[] = new MW_Common_Criteria_Expression_Combine_SQL('&&', $expr1);
     $objects[] = new MW_Common_Criteria_Expression_Combine_SQL('&&', $expr2);
     $object = new MW_Common_Criteria_Expression_Combine_SQL('||', $objects);
     $test = new MW_Common_Criteria_Expression_Combine_SQL('!', array($object));
     $expected = " NOT ( ( list IN ('a','b','c') AND string LIKE '%value%' ) OR ( float < 0.1 AND int > 10 ) )";
     $this->assertEquals($expected, $test->toString($types));
     $obj = new MW_Common_Criteria_Expression_Combine_SQL('&&', array());
     $this->assertEquals('', $obj->toString($types));
     $this->setExpectedException('MW_Common_Exception');
     new MW_Common_Criteria_Expression_Combine_SQL('', array());
 }
Esempio n. 9
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     $dbm = TestHelper::getDBManager();
     $dbm->release($this->_conn);
 }
Esempio n. 10
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     $sql = 'DROP TABLE "mw_tree_test"';
     $this->dbm = \TestHelper::getDBManager();
     $conn = $this->dbm->acquire();
     $conn->create($sql)->execute()->finish();
     $this->dbm->release($conn);
 }
Esempio n. 11
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     $this->_dbm = TestHelper::getDBManager();
     $conn = $this->_dbm->acquire();
     $conn->create('DROP TABLE "mw_cache_tag_test"')->execute()->finish();
     $conn->create('DROP TABLE "mw_cache_test"')->execute()->finish();
     $this->_dbm->release($conn);
 }
Esempio n. 12
0
 public function testFactory()
 {
     $config = array('sql' => array('delete' => '', 'deletebytag' => '', 'get' => '', 'getbytag' => '', 'set' => '', 'settag' => ''), 'search' => array('cache.id' => '', 'cache.siteid' => '', 'cache.value' => '', 'cache.expire' => '', 'cache.tag.name' => ''));
     $object = \Aimeos\MW\Cache\Factory::createManager('DB', $config, \TestHelper::getDBManager());
     $this->assertInstanceOf('\\Aimeos\\MW\\Cache\\Iface', $object);
 }