ajout SAE PHP 19/20 Meilleure note de la promo
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'mysql' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'travis',
|
||||
'password' => 'travis',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'mysql'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'mysql_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'mysql',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => '',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'travis',
|
||||
'password' => 'travis',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'mysql',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'mysqli' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'travis',
|
||||
'password' => 'travis',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'mysqli'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'mysqli_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'mysqli',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => '',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'travis',
|
||||
'password' => 'travis',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'mysqli',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'pdo/mysql' => array(
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=ci_test',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'travis',
|
||||
'password' => 'travis',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'mysql'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'pdo/mysql_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'mysql',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=ci_test',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => 'travis',
|
||||
'password' => 'travis',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'mysql'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'pdo/pgsql' => array(
|
||||
'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => 'postgres',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'pgsql'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'pdo/pgsql_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'pgsql',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => 'postgres',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'pgsql'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'pdo/sqlite' => array(
|
||||
'dsn' => 'sqlite:/'.realpath(__DIR__.'/../..').'/ci_test.sqlite',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => 'sqlite',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'sqlite'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'pdo/sqlite_failover' => array(
|
||||
'dsn' => 'sqlite:not_exists.sqlite',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => 'sqlite',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'sqlite',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => 'sqlite:/'.realpath(__DIR__.'/../..').'/ci_test.sqlite',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => 'sqlite',
|
||||
'dbdriver' => 'pdo',
|
||||
'subdriver' => 'sqlite'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'pgsql' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => 'postgres',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'postgre'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'pgsql_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'not_travis',
|
||||
'password' => 'wrong password',
|
||||
'database' => 'not_ci_test',
|
||||
'dbdriver' => 'postgre',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'postgres',
|
||||
'password' => 'postgres',
|
||||
'database' => 'ci_test',
|
||||
'dbdriver' => 'postgre',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
// Typical Database configuration
|
||||
'sqlite' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => realpath(__DIR__.'/..').'/ci_test.sqlite',
|
||||
'dbdriver' => 'sqlite3'
|
||||
),
|
||||
|
||||
// Database configuration with failover
|
||||
'sqlite_failover' => array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => '../not_exists.sqlite',
|
||||
'dbdriver' => 'sqlite3',
|
||||
'failover' => array(
|
||||
array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'sqlite',
|
||||
'password' => 'sqlite',
|
||||
'database' => realpath(__DIR__.'/..').'/ci_test.sqlite',
|
||||
'dbdriver' => 'sqlite3'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
142
SAE2.02_Application_WEB/tests/mocks/database/db.php
Normal file
142
SAE2.02_Application_WEB/tests/mocks/database/db.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_DB {
|
||||
|
||||
/**
|
||||
* @var array DB configuration
|
||||
*/
|
||||
private $config = array();
|
||||
|
||||
/**
|
||||
* @var string DB driver name
|
||||
*/
|
||||
private static $dbdriver = '';
|
||||
|
||||
/**
|
||||
* @var string DB sub-driver name
|
||||
*/
|
||||
private static $subdriver = '';
|
||||
|
||||
/**
|
||||
* Prepare database configuration skeleton
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build DSN connection string for DB driver instantiate process
|
||||
*
|
||||
* @param string Group name
|
||||
* @return string DSN Connection string
|
||||
*/
|
||||
public function set_dsn($group = 'default')
|
||||
{
|
||||
if ( ! isset($this->config[$group]))
|
||||
{
|
||||
throw new InvalidArgumentException('Group '.$group.' not exists');
|
||||
}
|
||||
|
||||
self::$dbdriver = $this->config[$group]['dbdriver'];
|
||||
if (isset($this->config[$group]['subdriver']))
|
||||
{
|
||||
self::$subdriver = $this->config[$group]['subdriver'];
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
'db_debug' => FALSE,
|
||||
'cache_on' => FALSE,
|
||||
'cachedir' => '',
|
||||
'char_set' => 'utf8',
|
||||
'dbcollat' => 'utf8_general_ci',
|
||||
'swap_pre' => '',
|
||||
'stricton' => FALSE
|
||||
);
|
||||
|
||||
$config = array_merge($this->config[$group], $params);
|
||||
$dsnstring = empty($config['dsn']) ? FALSE : $config['dsn'];
|
||||
$subdriver = empty($config['subdriver']) ? FALSE: $config['subdriver'];
|
||||
$failover = empty($config['failover']) ? FALSE : $config['failover'];
|
||||
|
||||
$dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password']
|
||||
.'@'.$config['hostname'].'/'.$config['database'];
|
||||
|
||||
// Build the parameter
|
||||
$other_params = array_slice($config, 6);
|
||||
if ($dsnstring) $other_params['dsn'] = $dsnstring;
|
||||
if ($subdriver) $other_params['subdriver'] = $subdriver;
|
||||
if ($failover) $other_params['failover'] = $failover;
|
||||
|
||||
return $dsn.'?'.http_build_query($other_params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a database config array
|
||||
*
|
||||
* @see ./config
|
||||
* @param string Driver based configuration
|
||||
* @return array
|
||||
*/
|
||||
public static function config($driver)
|
||||
{
|
||||
$dir = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR;
|
||||
return include($dir.'config'.DIRECTORY_SEPARATOR.$driver.'.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Main DB method wrapper
|
||||
*
|
||||
* @param string Group or DSN string
|
||||
* @param bool
|
||||
* @return object
|
||||
*/
|
||||
public static function DB($group, $query_builder = FALSE)
|
||||
{
|
||||
// Create dummy driver and builder files to "load" - the mocks have
|
||||
// already triggered autoloading of the real files
|
||||
$case = CI_TestCase::instance();
|
||||
$driver = self::$dbdriver;
|
||||
$subdriver = self::$subdriver;
|
||||
$case->ci_vfs_create(array(
|
||||
'DB_driver.php' => '',
|
||||
'DB_result.php' => '',
|
||||
'DB_forge.php' => '',
|
||||
'DB_query_builder.php' => ''
|
||||
), '', $case->ci_base_root, 'database');
|
||||
if (file_exists(SYSTEM_PATH.'database/drivers/'.$driver.'/'.$driver.'_driver.php'))
|
||||
{
|
||||
$case->ci_vfs_create(array(
|
||||
$driver.'_driver.php' => '',
|
||||
$driver.'_result.php' => '',
|
||||
$driver.'_forge.php' => ''
|
||||
), '', $case->ci_base_root, 'database/drivers/'.$driver);
|
||||
}
|
||||
if ($subdriver)
|
||||
{
|
||||
$case->ci_vfs_create(array(
|
||||
$driver.'_'.$subdriver.'_driver.php' => '',
|
||||
$driver.'_'.$subdriver.'_forge.php' => ''
|
||||
), '', $case->ci_base_root, 'database/drivers/'.$driver.'/subdrivers');
|
||||
}
|
||||
|
||||
include_once(SYSTEM_PATH.'database/DB.php');
|
||||
|
||||
try
|
||||
{
|
||||
$db = DB($group, $query_builder);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
throw new RuntimeException($e->getMessage());
|
||||
}
|
||||
|
||||
return $db;
|
||||
}
|
||||
|
||||
}
|
||||
40
SAE2.02_Application_WEB/tests/mocks/database/db/driver.php
Normal file
40
SAE2.02_Application_WEB/tests/mocks/database/db/driver.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_DB_Driver extends CI_DB_driver {
|
||||
|
||||
/**
|
||||
* @var object The actual Driver
|
||||
*/
|
||||
protected $ci_db_driver;
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param string DB Driver class name
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($driver_class, $config = array())
|
||||
{
|
||||
if (is_string($driver_class))
|
||||
{
|
||||
$this->ci_db_driver = new $driver_class($config);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloading method, emulate the actual driver method (multiple inheritance workaround)
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if ( ! is_callable(array($this->ci_db_driver, $method)))
|
||||
{
|
||||
throw new BadMethodCallException($method. ' not exists or not implemented');
|
||||
}
|
||||
|
||||
return call_user_func_array(array($this->ci_db_driver, $method), $arguments);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CI_DB extends CI_DB_query_builder {}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_Mysql extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_mysql_driver', $config);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_Mysqli extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_mysqli_driver', $config);
|
||||
}
|
||||
|
||||
}
|
||||
15
SAE2.02_Application_WEB/tests/mocks/database/drivers/pdo.php
Normal file
15
SAE2.02_Application_WEB/tests/mocks/database/drivers/pdo.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_PDO extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_pdo_driver', $config);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_Postgre extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_postgre_driver', $config);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Drivers_Sqlite extends Mock_Database_DB_Driver {
|
||||
|
||||
/**
|
||||
* Instantiate the database driver
|
||||
*
|
||||
* @param array DB configuration to set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct('CI_DB_sqlite3_driver', $config);
|
||||
}
|
||||
|
||||
}
|
||||
155
SAE2.02_Application_WEB/tests/mocks/database/schema/skeleton.php
Normal file
155
SAE2.02_Application_WEB/tests/mocks/database/schema/skeleton.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
class Mock_Database_Schema_Skeleton {
|
||||
|
||||
/**
|
||||
* @var object Database Holder
|
||||
*/
|
||||
public static $db;
|
||||
|
||||
/**
|
||||
* @var object Forge Holder
|
||||
*/
|
||||
public static $forge;
|
||||
|
||||
/**
|
||||
* @var object Driver Holder
|
||||
*/
|
||||
public static $driver;
|
||||
|
||||
/**
|
||||
* Initialize both database and forge components
|
||||
*/
|
||||
public static function init($driver)
|
||||
{
|
||||
if (empty(self::$db) && empty(self::$forge))
|
||||
{
|
||||
// E_DEPRECATED notices thrown by mysql_connect(), mysql_pconnect()
|
||||
// on PHP 5.5+ cause the tests to fail
|
||||
if ($driver === 'mysql' && version_compare(PHP_VERSION, '5.5', '>='))
|
||||
{
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
}
|
||||
|
||||
$config = Mock_Database_DB::config($driver);
|
||||
$connection = new Mock_Database_DB($config);
|
||||
$db = Mock_Database_DB::DB($connection->set_dsn($driver), TRUE);
|
||||
|
||||
CI_TestCase::instance()->ci_instance_var('db', $db);
|
||||
|
||||
$loader = new CI_Loader();
|
||||
$loader->dbforge();
|
||||
$forge = CI_TestCase::instance()->ci_instance_var('dbforge');
|
||||
|
||||
self::$db = $db;
|
||||
self::$forge = $forge;
|
||||
self::$driver = $driver;
|
||||
}
|
||||
|
||||
return self::$db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the dummy tables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function create_tables()
|
||||
{
|
||||
// User Table
|
||||
self::$forge->add_field(array(
|
||||
'id' => array(
|
||||
'type' => 'INTEGER',
|
||||
'constraint' => 3
|
||||
),
|
||||
'name' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 40
|
||||
),
|
||||
'email' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 100
|
||||
),
|
||||
'country' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 40
|
||||
)
|
||||
));
|
||||
self::$forge->add_key('id', TRUE);
|
||||
self::$forge->create_table('user', TRUE) OR show_error('Unable to create the `user` table');
|
||||
|
||||
// Job Table
|
||||
self::$forge->add_field(array(
|
||||
'id' => array(
|
||||
'type' => 'INTEGER',
|
||||
'constraint' => 3
|
||||
),
|
||||
'name' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 40
|
||||
),
|
||||
'description' => array(
|
||||
'type' => 'TEXT'
|
||||
)
|
||||
));
|
||||
self::$forge->add_key('id', TRUE);
|
||||
self::$forge->create_table('job', TRUE) OR show_error('Unable to create the `job` table');
|
||||
|
||||
// Misc Table
|
||||
self::$forge->add_field(array(
|
||||
'id' => array(
|
||||
'type' => 'INTEGER',
|
||||
'constraint' => 3
|
||||
),
|
||||
'key' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 40
|
||||
),
|
||||
'value' => array(
|
||||
'type' => 'TEXT'
|
||||
)
|
||||
));
|
||||
self::$forge->add_key('id', TRUE);
|
||||
self::$forge->create_table('misc', TRUE) OR show_error('Unable to create the `misc` table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the dummy datas
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function create_data()
|
||||
{
|
||||
// Job Data
|
||||
$data = array(
|
||||
'user' => array(
|
||||
array('id' => 1, 'name' => 'Derek Jones', 'email' => 'derek@world.com', 'country' => 'US'),
|
||||
array('id' => 2, 'name' => 'Ahmadinejad', 'email' => 'ahmadinejad@world.com', 'country' => 'Iran'),
|
||||
array('id' => 3, 'name' => 'Richard A Causey', 'email' => 'richard@world.com', 'country' => 'US'),
|
||||
array('id' => 4, 'name' => 'Chris Martin', 'email' => 'chris@world.com', 'country' => 'UK')
|
||||
),
|
||||
'job' => array(
|
||||
array('id' => 1, 'name' => 'Developer', 'description' => 'Awesome job, but sometimes makes you bored'),
|
||||
array('id' => 2, 'name' => 'Politician', 'description' => 'This is not really a job'),
|
||||
array('id' => 3, 'name' => 'Accountant', 'description' => 'Boring job, but you will get free snack at lunch'),
|
||||
array('id' => 4, 'name' => 'Musician', 'description' => 'Only Coldplay can actually called Musician')
|
||||
),
|
||||
'misc' => array(
|
||||
array('id' => 1, 'key' => '\\xxxfoo456', 'value' => 'Entry with \\xxx'),
|
||||
array('id' => 2, 'key' => '\\%foo456', 'value' => 'Entry with \\%'),
|
||||
array('id' => 3, 'key' => 'spaces and tabs', 'value' => ' One two three tab')
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($data as $table => $dummy_data)
|
||||
{
|
||||
self::$db->truncate($table) OR show_error("Unable to truncate `{$table}` table");
|
||||
|
||||
foreach ($dummy_data as $single_dummy_data)
|
||||
{
|
||||
self::$db->insert($table, $single_dummy_data) OR show_error("Unable to insert data into `{$table}` table");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user