| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 lmb_require('limb/dbal/src/dump/lmbMysqlDumpLoader.class.php'); 10 lmb_require(dirname(__FILE__) . '/lmbSQLDumpLoaderTestBase.class.php'); 11 12 if(!lmbToolkit :: instance()->getDefaultDbConnection() instanceof lmbMysqlConnection) 13 SimpleTest :: ignore('lmbMysqlDumpLoaderTest'); 14 15 class lmbMysqlDumpLoaderTest extends lmbSQLDumpLoaderTestBase 16 { 17 function _createLoader($file=null) 18 { 19 return new lmbMysqlDumpLoader($file); 20 } 21 22 function testFullBlownMysqlDump() 23 { 24 $sql = <<< EOD 25 /* 26 SQLyog Enterprise v4.06 RC1 27 Host - 4.0.12-max-debug : Database - all-limb-tests 28 ********************************************************************* 29 Server version : 4.0.12-max-debug 30 */ 31 32 SET FOREIGN_KEY_CHECKS=0; 33 34 create database if not exists `foo`; 35 36 /*Table structure for table `bar` */ 37 38 drop table if exists `bar`; 39 40 CREATE TABLE `bar` ( 41 `id` int(11) NOT null auto_increment, 42 `url` varchar(255) NOT null default '', 43 `description` varchar(255) default null, 44 `img_src` varchar(255) default null, 45 PRIMARY KEY (`id`), 46 KEY `id` (`id`,`oid`) 47 ) TYPE=InnoDB; 48 49 /*Data for the table `baz` */; 50 LOCK TABLES `baz` WRITE; 51 52 UNLOCK TABLES; 53 54 INSERT INTO `article` VALUES (8,101,2,'TemplateView','Template View','wiki'); 55 EOD; 56 57 $this->_writeDump($sql, $this->file_path); 58 59 $loader = $this->_createLoader($this->file_path); 60 61 $statements = $loader->getStatements(); 62 63 $this->assertEqual(sizeof($statements), 7); 64 65 $this->assertEqual($statements[0], 'SET FOREIGN_KEY_CHECKS=0'); 66 $this->assertEqual($statements[1], 'create database if not exists `foo`'); 67 $this->assertEqual($statements[2], 'drop table if exists `bar`'); 68 $this->assertEqual($statements[3], "CREATE TABLE `bar` ( 69 `id` int(11) NOT null auto_increment, 70 `url` varchar(255) NOT null default '', 71 `description` varchar(255) default null, 72 `img_src` varchar(255) default null, 73 PRIMARY KEY (`id`), 74 KEY `id` (`id`,`oid`) 75 ) TYPE=InnoDB"); 76 $this->assertEqual($statements[4], 'LOCK TABLES `baz` WRITE'); 77 $this->assertEqual($statements[5], 'UNLOCK TABLES'); 78 $this->assertEqual($statements[6], "INSERT INTO `article` VALUES (8,101,2,'TemplateView','Template View','wiki')"); 79 80 $this->assertEqual($loader->getAffectedTables(), array('article')); 81 } 82 } 83 84 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Sep 8 04:35:41 2008 | Cross-referenced by PHPXref 0.7 |