Skip to content

Commit f912700

Browse files
committed
updated integration bootstrap ad db creation scripts
1 parent 397fb0d commit f912700

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

core/tests/bootstrap-integration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
define('_PS_FRONT_', true); // Ensure front is enabled in the test environment
1010
}
1111

12+
require_once 'create-test-database.php';
13+
1214
require_once $projectDir . 'vendor/autoload.php';
1315
require_once $rootDirectory . 'config/config.inc.php';
1416

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
<?php
22

3-
$rootDirectory = __DIR__ . '/../../../../../';
4-
$projectDir = __DIR__ . '/../../../';
3+
$rootDirectory = __DIR__ . '/../../../../../../';
4+
$projectDir = __DIR__ . '/../../../../';
55

6-
require_once $projectDir . 'vendor/autoload.php';
7-
require_once $rootDirectory . 'config/config.inc.php';
8-
9-
if (file_exists($rootDirectory . 'vendor/autoload.php')) {
10-
require_once $rootDirectory . 'vendor/autoload.php';
11-
}
12-
13-
if (file_exists($rootDirectory . 'autoload.php')) {
14-
require_once $rootDirectory . 'autoload.php';
15-
}
16-
17-
// Source database details
18-
$sourceHost = '172.26.0.2';
19-
$sourceUser = _DB_USER_;
20-
$sourcePassword = _DB_PASSWD_;
21-
$sourceDatabase = _DB_NAME_;
6+
$sourceHost = defined('_DB_SERVER_') ? _DB_SERVER_ : 'mysql';
7+
$sourceUser = defined('_DB_USER_') ? _DB_USER_ : 'root';
8+
$sourcePassword = defined('_DB_PASSWD_') ? _DB_PASSWD_ : 'prestashop';
9+
$sourceDatabase = defined('_DB_NAME_') ? _DB_NAME_ : 'prestashop';
2210

2311
// Target (new) database details
2412
$targetDatabase = 'test_' . $sourceDatabase;
2513

2614
$createDatabaseCommand = "mysql -h$sourceHost -u$sourceUser -p$sourcePassword -e 'DROP DATABASE IF EXISTS `" . $targetDatabase . '`; CREATE DATABASE `' . $targetDatabase . "`'";
2715
$importCommand = "mysqldump -h$sourceHost -u" . $sourceUser . " -p'" . $sourcePassword . "' " . $sourceDatabase . " | mysql -h$sourceHost -u " . $sourceUser . " --password='" . $sourcePassword . "' " . $targetDatabase;
2816

29-
echo 'Step 1: Creating New Database' . PHP_EOL;
30-
echo shell_exec($createDatabaseCommand) . PHP_EOL;
17+
//echo 'Step 1: Creating New Database' . PHP_EOL;
18+
//echo shell_exec($createDatabaseCommand) . PHP_EOL;
19+
//
20+
//echo 'Step 2: Importing into New Database' . PHP_EOL;
21+
//echo shell_exec($importCommand) . PHP_EOL;
3122

32-
echo 'Step 2: Importing into New Database' . PHP_EOL;
33-
echo shell_exec($importCommand) . PHP_EOL;
23+
shell_exec($createDatabaseCommand);
24+
shell_exec($importCommand);

0 commit comments

Comments
 (0)