Exemple #1
0
 /**
  */
 public function testSchema()
 {
     $this->object->executeDdl("CREATE TABLE `users` ( name varchar(20) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $this->object->executeDdl("CREATE VIEW `v_users` AS SELECT `name` FROM `users`;");
     $schema = $this->object->schema();
     $this->assertNotEmpty($schema);
     $versionMysqld = $this->object->getVersionServer();
     $versionMysqld = (double) substr($versionMysqld, 0, 3);
     if ($versionMysqld <= 5.0) {
         $expected = "CREATE TABLE `users` (\n  `name` varchar(20) default NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE ALGORITHM=UNDEFINED DEFINER=`" . USER_MYSQL_DEFAULT . "`@`localhost` SQL SECURITY DEFINER VIEW `v_users` AS select `users`.`name` AS `name` from `users`;\n\n";
     } else {
         $expected = "CREATE TABLE `users` (\n  `name` varchar(20) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nCREATE ALGORITHM=UNDEFINED DEFINER=`" . USER_MYSQL_DEFAULT . "`@`localhost` SQL SECURITY DEFINER VIEW `v_users` AS select `users`.`name` AS `name` from `users`;\n\n";
     }
     $this->assertEquals($expected, $schema);
 }