phpmyadmin/test
Eyüp Can Akman ce12a87858
Fix #20284 - Preserve numeric strings in XML imports
When the XML file embeds the table structure, $analyses is null and
buildSql() falls back to is_numeric() to decide whether to quote. That
strips quotes from values like "01234", which silently drops the leading
zero on a varchar column and causes a duplicate-key error if the table
also contains "1234".

Add a roundtrip check: a value is still treated as numeric only when
casting it to int or float gives back the original string. "01234",
"1e10" and similar fail the roundtrip and stay quoted; plain integers
like 1 and 1234 keep their existing unquoted form.

Signed-off-by: Eyüp Can Akman <eyupcanakman@gmail.com>
2026-04-28 17:26:03 +03:00
..
classes Fix #20284 - Preserve numeric strings in XML imports 2026-04-28 17:26:03 +03:00
javascript Linting 2023-01-15 04:04:41 +02:00
jest Remove stickyfilljs JavaScript dependency 2022-04-27 19:47:31 -03:00
selenium Fix uses of static $createDatabase 2026-02-24 10:50:12 +01:00
stubs Add stub file for uploadprogress_get_info function 2022-01-19 14:49:12 -03:00
test_data Fix #20284 - Preserve numeric strings in XML imports 2026-04-28 17:26:03 +03:00
bootstrap-dist.php Add TEST_PATH for out of source tests 2023-01-28 09:18:56 +01:00
bootstrap-static.php Fix Psalm error related to TEST_PATH constant 2023-01-28 14:37:51 -03:00
ci-phplint Fail on lint error 2025-09-22 17:15:39 +02:00
config.e2e.inc.php Fix server login and documentation 2021-02-08 22:26:21 +01:00
doctum-config.php Upgrade Doctum to ^5.3.0 2020-12-21 15:10:30 +01:00
nginx.conf Fix logs system and temp dir for tests 2021-02-09 02:01:23 +01:00
php-fpm.conf Fix logs system and temp dir for tests 2021-02-09 02:01:23 +01:00
php.ini Remove all references to deprecated extension mcrypt 2020-04-05 20:57:07 +02:00
phpstan-constants.php Remove PMA_IS_WINDOWS constant 2022-04-24 20:37:55 -03:00
phpunit-php-nightly.xml Fix some tests with PHP 8.1 2021-06-11 18:14:40 -03:00
README.rst Fix server login and documentation 2021-02-08 22:26:21 +01:00
start-local-server Fix logs system and temp dir for tests 2021-02-09 02:01:23 +01:00
stop-local-server Fix logs system and temp dir for tests 2021-02-09 02:01:23 +01:00

PhpMyAdmin test suite
=====================

This directory is protected from web visitors by a .htaccess file.

For more information on allowing http access to this directory see:
https://httpd.apache.org/docs/current/mod/mod_authz_host.html#allow

Please visit the wiki for more information on unit testing:
https://wiki.phpmyadmin.net/pma/Unit_Testing

Selenium tests
--------------

To be able to run Selenium tests, you need to have webserver, database
and Selenium running. Following environment variables configure where
testsuite connects:

TESTSUITE_USER
    Username to connect on the interface located at TESTSUITE_URL
TESTSUITE_PASSWORD
    Password to connect on the interface located at TESTSUITE_URL
TESTSUITE_DATABASE_PREFIX
    Database prefix to use for testing (Avoid database grouping characters like _).
TESTSUITE_URL
    URL where tested phpMyAdmin is available.

Additionally you need to configure link to Selenium and browsers. You
can either setup Selenium locally or use BrowserStack automated testing.

For local setup, define following:

TESTSUITE_SELENIUM_HOST
    Host where Selenium is running.
TESTSUITE_SELENIUM_PORT
    Port where to connect.
TESTSUITE_SELENIUM_BROWSER
    Browser to use for testing inside Selenium.

With BrowserStack, set following:

TESTSUITE_BROWSERSTACK_USER
    BrowserStack username.
TESTSUITE_BROWSERSTACK_KEY
    BrowserStack access key.

For example you can use following setup in ``phpunit.xml``::

    <php>
        <env name="TESTSUITE_USER" value="root"/>
        <env name="TESTSUITE_PASSWORD" value="root"/>
        <env name="TESTSUITE_DATABASE_PREFIX" value="test"/>
        <env name="TESTSUITE_URL" value="http://localhost/phpmyadmin/" />
        <env name="TESTSUITE_SELENIUM_HOST" value="127.0.0.1" />
        <env name="TESTSUITE_SELENIUM_PORT" value="4444" />
    </php>

Using BrowserStack
------------------

We're using our selenium tests on the GitHub CI.

To run tests locally, you need to install BrowserStack tool to enable local
testing, see their website for instructions:

https://www.browserstack.com/local-testing#command-line

Following instructions use PHP's built in server for the testing::

    # Export BrowserStack credentials in the environment:
    export TESTSUITE_BROWSERSTACK_USER=your_username
    export TESTSUITE_BROWSERSTACK_KEY=your_key

    # Port where tests will be running
    export TESTSUITE_PORT=9000
    export TESTSUITE_URL=http://127.0.0.1:$TESTSUITE_PORT/

    # Start PHP built in server
    php --server 127.0.0.1:$TESTSUITE_PORT > php.log &

    # Start BrowserStack Local client to forward the traffic
    ~/browserstack/BrowserStackLocal -localIdentifier Manual "$TESTSUITE_BROWSERSTACK_KEY" 127.0.0.1,$TESTSUITE_PORT,0 &

    # Stop BrowserStack Local
    ~/browserstack/BrowserStackLocal --daemon stop