Skip to content

Add unit tests for some controller classes#20191

Merged
MauricioFauth merged 7 commits intophpmyadmin:masterfrom
MauricioFauth:controllers-tests
Feb 28, 2026
Merged

Add unit tests for some controller classes#20191
MauricioFauth merged 7 commits intophpmyadmin:masterfrom
MauricioFauth:controllers-tests

Conversation

@MauricioFauth
Copy link
Member

These kind of tests are not great, as they're sensible to white space changes in the output, but it's better than nothing.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
@MauricioFauth MauricioFauth merged commit de656cb into phpmyadmin:master Feb 28, 2026
64 of 65 checks passed
@MauricioFauth MauricioFauth deleted the controllers-tests branch February 28, 2026 22:54
@MauricioFauth MauricioFauth self-assigned this Feb 28, 2026
@MauricioFauth MauricioFauth added this to the 6.0.0 milestone Feb 28, 2026
@MoonE
Copy link
Contributor

MoonE commented Mar 4, 2026

@MauricioFauth This test occasionally fails because of the query duration 0.0000 <-> 0.0001

1) PhpMyAdmin\Tests\Controllers\Database\MultiTableQuery\QueryControllerTest::testController
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
   
 <div class="card mb-3 result_query">
 <div class="alert alert-success border-top-0 border-start-0 border-end-0 rounded-bottom-0 mb-0" role="alert">
-  <img src="themes/dot.gif" title="" alt="" class="icon ic_s_success"> Showing rows 0 -  2 (3 total, Query took 0.0000 seconds.)
+  <img src="themes/dot.gif" title="" alt="" class="icon ic_s_success"> Showing rows 0 -  2 (3 total, Query took 0.0001 seconds.)
 </div>
 <div class="card-body sqlOuter"><pre><code class="sql" dir="ltr">SELECT `test_table`.* FROM `test_table`;</code></pre></div>
 <div class="card-footer tools d-print-none">

/app/tests/unit/Controllers/Database/MultiTableQuery/QueryControllerTest.php:60

@liviuconcioiu
Copy link
Contributor

I have one too:

2) PhpMyAdmin\Tests\Controllers\Database\ImportControllerTest::testController
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'...may be compressed (gzip, bzip2, zip) or uncompressed.<br>\n
+'...may be compressed (gzip, zip) or uncompressed.<br>\n
               A compressed file's name must end in <strong>.[format].[compression]</strong>. Example: <strong>.sql.zip</strong>\n
             </p>\n
           \n
                       <div class="mb-3">\n
-              <label class="form-label" for="input_import_file">Browse your computer: <small>(Max: 2,048KiB)</small></label>\n
+              <label class="form-label" for="input_import_file">Browse your computer: <small>(Max: 1,024MiB)</small></label>\n
      ...'

E:\GitHub\phpmyadmin\tests\unit\Controllers\Database\ImportControllerTest.php:41

@MauricioFauth MauricioFauth mentioned this pull request Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants