1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-06 14:46:36 +02:00

Tests: Run also in PDO

This commit is contained in:
Jakub Vrana
2025-03-22 07:22:06 +01:00
parent 01a6af8b70
commit ab44927442
4 changed files with 18 additions and 2 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@
/editor/adminer-dark.css
/adminer*.php
/editor*.php
/tests/pdo-*.html
/vendor/
adminer-plugins/
adminer-plugins.php

16
tests/generate-pdo.php Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env php
<?php
// Katalon Recorder has global variables: https://docs.katalon.com/katalon-platform/plugins-and-add-ons/katalon-recorder-extension/get-your-job-done/automate-scenarios/global-variables-in-katalon-recorder
// It's possible to use them in URL in Katalon Studio but apparently not in Recorder: https://forum.katalon.com/t/45673/2
foreach (glob("*.html") as $filename) {
if (!preg_match('~^pdo-~', $filename)) {
$file = file_get_contents($filename);
$file = preg_replace_callback('~/(adminer(/sqlite)?|editor/example)\.php(\??)~', function ($match) {
return "/$match[1].php?ext=pdo" . ($match[3] ? "&amp;" : "");
}, $file);
$file = str_replace("<tr><td>open</td><td>/coverage.php?coverage=0</td><td></td></tr>\n", "", $file);
$file = preg_replace("~//input\[@value='Login']~", "\\0</td><td></td></tr>\n<tr><td>verifyTextPresent</td><td>PDO_", $file, 1);
file_put_contents("pdo-$filename", $file);
}
}

View File

@@ -16,7 +16,6 @@
<tr><td>select</td><td>name=auth[driver]</td><td>label=PostgreSQL</td></tr>
<tr><td>type</td><td>id=username</td><td>ODBC</td></tr>
<tr><td>type</td><td>name=auth[password]</td><td>ODBC</td></tr>
<tr><td>type</td><td>name=auth[db]</td><td>adminer_test</td></tr>
<tr><td>clickAndWait</td><td>//input[@value='Login']</td><td></td></tr>
</tbody></table>

View File

@@ -16,7 +16,7 @@
<tr><td>select</td><td>name=auth[driver]</td><td>label=SQLite</td></tr>
<tr><td>type</td><td>id=username</td><td>ODBC</td></tr>
<tr><td>type</td><td>name=auth[password]</td><td>YOUR_PASSWORD_HERE</td></tr>
<tr><td>click</td><td>css=input[type="submit"]</td><td></td></tr>
<tr><td>click</td><td>//input[@value='Login']</td><td></td></tr>
<tr><td>click</td><td>link=Create database</td><td></td></tr>
<tr><td>type</td><td>name=name</td><td>adminer_test</td></tr>
<tr><td>click</td><td>css=input[type="submit"]</td><td></td></tr>