Repository navigation
Expand file tree
/
Copy pathtest_connection.php
More file actions
115 lines (103 loc) · 3.03 KB
/
Copy pathtest_connection.php
File metadata and controls
115 lines (103 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
* Simple test script for YSRTech_M2API module
* This tests basic connectivity and module functionality
*/
// Test 1: Check if module files exist
echo "=== YSRTech_M2API Module Test ===\n\n";
echo "Test 1: Checking module files...\n";
$modulePath = __DIR__ . '/app/code/local/YSRTech/M2API';
$moduleXml = __DIR__ . '/app/etc/modules/YSRTech_M2API.xml';
if (file_exists($modulePath)) {
echo "✓ Module directory exists\n";
} else {
echo "✗ Module directory NOT found\n";
}
if (file_exists($moduleXml)) {
echo "✓ Module XML exists\n";
} else {
echo "✗ Module XML NOT found\n";
}
// Test 2: Check module configuration
echo "\nTest 2: Checking module configuration...\n";
$configFile = $modulePath . '/etc/config.xml';
if (file_exists($configFile)) {
echo "✓ Config file exists\n";
$config = simplexml_load_file($configFile);
if ($config) {
$version = (string)$config->modules->YSRTech_M2API->version;
echo "✓ Module version: $version\n";
}
} else {
echo "✗ Config file NOT found\n";
}
// Test 3: Check required module files
echo "\nTest 3: Checking core module files...\n";
$requiredFiles = [
'Model/Auth.php',
'Model/Apikey.php',
'Model/Resource/Apikey.php',
'Model/Resource/Apikey/Collection.php',
'Model/Observer.php',
'Helper/Data.php',
'Controller/Router.php',
'Controller/AuctaneRouter.php',
'controllers/RestController.php',
'controllers/AuctaneController.php',
'controllers/Adminhtml/M2api/ApikeyController.php',
'etc/system.xml',
'etc/adminhtml.xml',
'sql/ysrtech_m2api_setup/install-0.2.0.php'
];
$allFilesExist = true;
foreach ($requiredFiles as $file) {
$fullPath = $modulePath . '/' . $file;
if (file_exists($fullPath)) {
echo "✓ $file\n";
} else {
echo "✗ $file NOT found\n";
$allFilesExist = false;
}
}
// Test 4: Basic PHP syntax check
echo "\nTest 4: Checking PHP syntax...\n";
$phpFiles = [
'Model/Auth.php',
'Model/Apikey.php',
'Helper/Data.php',
'controllers/RestController.php',
'controllers/AuctaneController.php',
'controllers/Adminhtml/M2api/ApikeyController.php'
];
$syntaxOk = true;
foreach ($phpFiles as $file) {
$fullPath = $modulePath . '/' . $file;
if (file_exists($fullPath)) {
exec("php -l \"$fullPath\" 2>&1", $output, $returnVar);
if ($returnVar === 0) {
echo "✓ $file - syntax OK\n";
} else {
echo "✗ $file - syntax error\n";
$syntaxOk = false;
}
}
}
// Summary
echo "\n=== Test Summary ===\n";
if ($allFilesExist && $syntaxOk) {
echo "✓ All tests passed! Module structure is valid.\n";
} else {
echo "✗ Some tests failed. Please review the output above.\n";
}
echo "\n=== GitHub Repository Info ===\n";
// Check git status
exec("git remote -v 2>&1", $gitOutput);
if (!empty($gitOutput)) {
echo "Git remotes:\n";
foreach ($gitOutput as $line) {
echo " $line\n";
}
} else {
echo "No git remotes configured.\n";
}
echo "\nTest completed!\n";