Exemplo n.º 1
0
 public static function setUpBeforeClass()
 {
     self::$dbm = \TestHelperMw::getDBManager();
     if (!self::$dbm instanceof \Aimeos\MW\DB\Manager\DBAL) {
         return;
     }
     $schema = new \Doctrine\DBAL\Schema\Schema();
     $cacheTable = $schema->createTable('mw_cache_test');
     $cacheTable->addColumn('id', 'string', array('length' => 255));
     $cacheTable->addColumn('siteid', 'integer', array('notnull' => false));
     $cacheTable->addColumn('expire', 'datetime', array('notnull' => false));
     $cacheTable->addColumn('value', 'text', array('length' => 0xffff));
     $cacheTable->addUniqueIndex(array('id', 'siteid'));
     $cacheTable->addIndex(array('expire'));
     $tagTable = $schema->createTable('mw_cache_tag_test');
     $tagTable->addColumn('tid', 'string', array('length' => 255));
     $tagTable->addColumn('tsiteid', 'integer', array('notnull' => false));
     $tagTable->addColumn('tname', 'string', array('length' => 255));
     $tagTable->addUniqueIndex(array('tid', 'tsiteid', 'tname'));
     $tagTable->addForeignKeyConstraint('mw_cache_test', array('tid', 'tsiteid'), array('id', 'siteid'), array('onDelete' => 'CASCADE'));
     $conn = self::$dbm->acquire();
     foreach ($schema->toSQL($conn->getRawObject()->getDatabasePlatform()) as $sql) {
         $conn->create($sql)->execute()->finish();
     }
     self::$dbm->release($conn);
 }
Exemplo 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 = \TestHelperMw::getConfig();
     if ($this->config->get('resource/db/adapter', false) === false) {
         $this->markTestSkipped('No database configured');
     }
     $this->dbm = \TestHelperMw::getDBManager();
 }
Exemplo 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()
 {
     $this->dbm = \TestHelperMw::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);
 }
Exemplo n.º 4
0
 protected function tearDown()
 {
     if (($adapter = \TestHelperMw::getConfig()->get('resource/db/adapter', false)) === 'pgsql') {
         $this->dbm = \TestHelperMw::getDBManager();
         $conn = $this->dbm->acquire();
         $conn->create('DROP TABLE "mw_setup_dbschema_test"')->execute()->finish();
         $this->dbm->release($conn);
     }
 }
Exemplo 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()
 {
     if (\TestHelperMw::getConfig()->get('resource/db/adapter', false) === false) {
         $this->markTestSkipped('No database configured');
     }
     $dbm = \TestHelperMw::getDBManager();
     $conn = $dbm->acquire();
     $this->object = new \Aimeos\MW\Criteria\SQL($conn);
     $dbm->release($conn);
 }
Exemplo n.º 6
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 (\TestHelperMw::getConfig()->get('resource/db/adapter', false) === false) {
         return;
     }
     $this->dbm = \TestHelperMw::getDBManager();
     $conn = $this->dbm->acquire();
     $conn->create('DROP TABLE "mw_log_test"')->execute()->finish();
     $this->dbm->release($conn);
 }
Exemplo n.º 7
0
 protected function setUp()
 {
     $config = \TestHelperMw::getConfig();
     if ($config->get('resource/db/adapter', false) === false) {
         $this->markTestSkipped('No database configured');
     }
     $dbm = \TestHelperMw::getDBManager();
     $conn = $dbm->acquire();
     $schema = new \Aimeos\MW\Setup\DBSchema\Mysql($conn, $config->get('resource/db/database', 'notfound'), 'mysql');
     $this->object = new BaseImpl($schema, $conn);
     $dbm->release($conn);
 }
Exemplo n.º 8
0
 public static function setUpBeforeClass()
 {
     self::$dbm = \TestHelperMw::getDBManager();
     if (!self::$dbm instanceof \Aimeos\MW\DB\Manager\DBAL) {
         return;
     }
     $schema = new \Doctrine\DBAL\Schema\Schema();
     $table = $schema->createTable('mw_log_test');
     $table->addColumn('facility', 'string', array('length' => 32));
     $table->addColumn('request', 'string', array('length' => 32));
     $table->addColumn('tstamp', 'string', array('length' => 20));
     $table->addColumn('priority', 'integer', array());
     $table->addColumn('message', 'text', array('length' => 0xffff));
     $conn = self::$dbm->acquire();
     foreach ($schema->toSQL($conn->getRawObject()->getDatabasePlatform()) as $sql) {
         $conn->create($sql)->execute()->finish();
     }
     self::$dbm->release($conn);
 }
Exemplo n.º 9
0
 public static function setUpBeforeClass()
 {
     self::$dbm = \TestHelperMw::getDBManager();
     if (!self::$dbm instanceof \Aimeos\MW\DB\Manager\DBAL) {
         return;
     }
     $schema = new \Doctrine\DBAL\Schema\Schema();
     $table = $schema->createTable('mw_mqueue_test');
     $table->addColumn('id', 'integer', array('autoincrement' => true));
     $table->addColumn('queue', 'string', array('length' => 255));
     $table->addColumn('cname', 'string', array('length' => 32));
     $table->addColumn('rtime', 'datetime', array());
     $table->addColumn('message', 'text', array('length' => 0xffff));
     $table->setPrimaryKey(array('id'));
     $conn = self::$dbm->acquire();
     foreach ($schema->toSQL($conn->getRawObject()->getDatabasePlatform()) as $sql) {
         $conn->create($sql)->execute()->finish();
     }
     self::$dbm->release($conn);
 }
Exemplo n.º 10
0
 public static function setUpBeforeClass()
 {
     self::$dbm = \TestHelperMw::getDBManager();
     if (!self::$dbm instanceof \Aimeos\MW\DB\Manager\DBAL) {
         return;
     }
     $schema = new \Doctrine\DBAL\Schema\Schema();
     $table = $schema->createTable('mw_tree_test');
     $table->addColumn('id', 'integer', array('autoincrement' => true));
     $table->addColumn('parentid', 'integer', array('notnull' => false));
     $table->addColumn('label', 'string', array('length' => 16));
     $table->addColumn('code', 'string', array('length' => 32));
     $table->addColumn('level', 'integer', array());
     $table->addColumn('nleft', 'integer', array());
     $table->addColumn('nright', 'integer', array());
     $table->addColumn('status', 'smallint', array());
     $table->setPrimaryKey(array('id'));
     $conn = self::$dbm->acquire();
     foreach ($schema->toSQL($conn->getRawObject()->getDatabasePlatform()) as $sql) {
         $conn->create($sql)->execute()->finish();
     }
     self::$dbm->release($conn);
 }
Exemplo n.º 11
0
 public function testToString()
 {
     $dbm = \TestHelperMw::getDBManager();
     $conn = $dbm->acquire();
     $dbm->release($conn);
     $types = array('list' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, 'string' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, 'float' => \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT, 'int' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, 'undefined' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, 'bool' => \Aimeos\MW\DB\Statement\Base::PARAM_BOOL);
     $expr1 = array();
     $expr1[] = new \Aimeos\MW\Criteria\Expression\Compare\SQL($conn, '==', 'list', array('a', 'b', 'c'));
     $expr1[] = new \Aimeos\MW\Criteria\Expression\Compare\SQL($conn, '~=', 'string', 'value');
     $expr2 = array();
     $expr2[] = new \Aimeos\MW\Criteria\Expression\Compare\SQL($conn, '<', 'float', 0.1);
     $expr2[] = new \Aimeos\MW\Criteria\Expression\Compare\SQL($conn, '>', 'int', 10);
     $objects = array();
     $objects[] = new \Aimeos\MW\Criteria\Expression\Combine\SQL('&&', $expr1);
     $objects[] = new \Aimeos\MW\Criteria\Expression\Combine\SQL('&&', $expr2);
     $object = new \Aimeos\MW\Criteria\Expression\Combine\SQL('||', $objects);
     $test = new \Aimeos\MW\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 \Aimeos\MW\Criteria\Expression\Combine\SQL('&&', array());
     $this->assertEquals('', $obj->toString($types));
     $this->setExpectedException('\\Aimeos\\MW\\Common\\Exception');
     new \Aimeos\MW\Criteria\Expression\Combine\SQL('', array());
 }
Exemplo n.º 12
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 = \TestHelperMw::getDBManager();
     $conn = $this->dbm->acquire();
     $conn->create($sql)->execute()->finish();
     $this->dbm->release($conn);
 }
Exemplo n.º 13
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 = \TestHelperMw::getDBManager();
     $dbm->release($this->conn);
 }
Exemplo n.º 14
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, \TestHelperMw::getDBManager());
     $this->assertInstanceOf('\\Aimeos\\MW\\Cache\\Iface', $object);
 }